-2

so I know the function DateTimeOffset.Now.Offset returns the offset from UTC and from wikipedia it states that GMT and UTC are the same. Therefore I would guess that DateTimeOffset.Now.Offset.ToString() would always return 00:00:00 if your timezone is (UTC) London. Am I correct in thinking this or would it return 01:00:00 when in daylight savings time?

JKennedy
  • 18,150
  • 17
  • 114
  • 198
  • Don't you have a compiler? Why don't you try and see? – Soner Gönül Feb 13 '15 at 08:54
  • I'm not sure how I can test it? I changed my date to mid april (daylight savings) but the time obviously remains the same. I'd guess if UTC = GMT then it should return `00:00:00` – JKennedy Feb 13 '15 at 08:55

1 Answers1

1

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

Right. From documentation of DateTimeOffset.Offset property;

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

As you can see, it is normal to get 00:00:00 since London is UTC±00:00 which is what we are expected.

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

Exactly. From Wikipedia page of 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.

By the way, you can't change your offset value with creating a Datetime which it is in your daylight saving time. OffSet value can be change only with changing your time zone manually or with daylight saving time. Your DateTimeOffset still has the same offset value even if you create it when times that daylight saving time.

Yes, UTC and GMT are the same. Just "GMT" term are not using most of computer science community.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
  • 1
    Thanks for the help. For anyone else wondering this [link](http://www.timeanddate.com/time/zones/bst) provides concise information – JKennedy Feb 13 '15 at 09:34