在英国夏令时时 DateTimeOffset.Now.Offset.ToString() return 是什么意思

What does DateTimeOffset.Now.Offset.ToString() return when in daylight savigs time in the UK

所以我知道函数 DateTimeOffset.Now.Offset returns 与 UTC 和维基百科的偏移量它指出 GMT 和 UTC 是相同的。因此,如果您的时区是 (UTC) 伦敦,我猜想 DateTimeOffset.Now.Offset.ToString() 总是 return 00:00:00。我的想法是正确的还是 return 01:00:00 在夏令时?

DateTimeOffset.Now.Offset.ToString() would always return 00:00:00 if your timezone is UTC.

没错。来自 DateTimeOffset.Offset property;

的文档

The difference between the current DateTimeOffset object's time value and Coordinated Universal Time (UTC).

如您所见,得到 00:00:00 是正常的,因为伦敦是 UTC±00:00,这是我们所期望的。

Am I correct in thinking this or would it return 01:00:00 when in daylight savings time?

没错。来自 Daylight saving time;

的维基百科页面

Typically, users of DST adjust clocks forward one hour near the start of spring and adjust them backward in the autumn to "normal" or regular time.

顺便说一句,您不能通过创建夏令时的Datetime来更改偏移值。 OffSet 值只能通过手动更改时区或夏令时来更改。你的 DateTimeOffset still 具有相同的偏移值 even 如果你在那个夏令时创建它。

是的,UTC 和 GMT 是一样的。只是 "GMT" 术语没有被大多数计算机科学社区使用。