DateTimeOffset is a data structure that encapsulates a DateTime value and the Offset from UTC that the value reflects. It is used to represent an instantaneous moment in time, while still capturing the perspective of the observer.
DateTimeOffset
is a data structure that encapsulates a DateTime
value and the Offset
from UTC that the value reflects. It is used to represent an instantaneous moment in time, while still capturing the perspective of the observer.
Contrary to popular belief (and to much of the documentation) the offset provided does not represent a time zone. One might start with a time zone to obtain the offset, but it is a one-way function. You can not determine the time zone by the offset alone. For a better understanding of this, see this community wiki answer.
The preferred serialization format for this type of data is defined as part of the ISO-8601 specification.
- Example:
1997-07-16T19:20:30+01:00
DateTimeOffset
and similar structures are presented in:
- The
DateTimeOffset
structure the Microsoft .Net Framework - The
datetimeoffset
data type in Microsoft SQL Server - The
OffsetDateTime
structure in the NodaTime library - The
OffsetDateTime
class in thejava.time
package - The
TIMESTAMP WITH TIMEZONE
datatype in Oracle pl/sql- But only the variation that uses just an offset, rather than a "time zone region".
Please update this list if you are aware of similar structures in other languages, frameworks, or databases