Timeline for DateTime vs DateTimeOffset
Current License: CC BY-SA 4.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 30, 2024 at 6:14 | comment | added | Jared Thirsk | Is there an error in the Microsoft docs? Pacific Standard Time is -08:00, whereas Pacific Daylight Time is -07:00. | |
| Mar 9, 2023 at 20:20 | comment | added | Stajs |
@Wouter FYI I can see the examples in the link from nawfal, e.g.: +01:00 could belong to the following time zones: (GMT+01:00) Amsterdam (GMT+01:00) Belgrade (GMT+01:00) Brussels (GMT+01:00) Sarajevo (GMT+01:00) West Central Africa
|
|
| Feb 19, 2023 at 9:10 | comment | added | Wouter | Did you get the right link as I don’t see any examples in there. | |
| Feb 17, 2023 at 12:01 | comment | added | nawfal | @Wouter MS official docs has an example: learn.microsoft.com/en-us/dotnet/standard/datetime/…. An example of a time that can be from 3 different timezones. | |
| Feb 17, 2023 at 11:47 | comment | added | Wouter | @nawfal Yes... I guess although if you want to know where (a timezone) you looked at a clock (datetimeoffset) It is not the clock that will be telling you even if it is displaying the correct datetimeoffset for it's timezone. As it might just as well be the same time in different timezone? (So is there an example of this "collision"?) | |
| Feb 17, 2023 at 11:28 | comment | added | nawfal |
@Wouter just to be more accurate, DateTimeOffset.Now doesn't tell you which timezone it was, just what offset it was from. A timezone can have multiple offsets and same offset can be shared among many timezones. But I get what you are saying.
|
|
| Sep 27, 2022 at 15:23 | comment | added | Wouter |
@Morten_564834 @Mojtaba using DateTimeOffset.Now tells you also in which timezone it was created. But personally I would use DateTime.UtcNow for these technical fields. (But yes that requires people to use utc) which you could check for in a property accesor.
|
|
| Mar 30, 2021 at 7:34 | comment | added | Mojtaba |
@Morten_564834 I would say DateTimeOffset.Now because you can then compare CreatedDate irrespective of their timezone.
|
|
| Mar 29, 2021 at 21:23 | comment | added | Morten_564834 | So lets say I need to store a CreatedDate property when the user created something. Do I pass DatetimeOffset.Now or UtcNow to the server? | |
| Oct 19, 2018 at 9:32 | history | answered | Mojtaba | CC BY-SA 4.0 |