Sunday, February 14, 2016

Azure: DateTimeOffset

Many of Azure storage APIs are using DateTimeOffset .NET type instead of usual DateTime.
That structure includes UTC times and local offset to UTC

Choosing Between DateTime, DateTimeOffset, TimeSpan, and TimeZoneInfo @ MSDN

datetimeoffset (Transact-SQL)
Storage size: 10 bytes, fixed is the default with the default of 100ns fractional second precision

course: Date and Time Fundamentals | Pluralsight

c# - DateTime vs DateTimeOffset - Stack Overflow
Instantaneous Time vs Calendar Time Visualization
"If you ever need to modify a previously recorded DateTimeOffset - you don't have enough information in the offset alone to ensure that the new offset is still relevant for the user. You must also store a timezone identifier (think - I need the name of that camera so I can take a new picture even if the position has changed).

It should also be pointed out that Noda Time has a representation called ZonedDateTime for this, while the .Net base class library does not have anything similar. You would need to store both a DateTimeOffset and a TimeZoneInfo.Id value."



No comments: