SQL Server DATETIMEOFFSET
“In this article, we will learn the various properties and the usage of the DATETIMEOFFSET data type in SQL Server. This data type allows you to define a date value that combines the time section and the time zone based on UTC or GMT.”
The following is the syntax of the DATETIMEOFFSET value in SQL Server.
The fraction seconds precision argument is optional.
There are two main ways you can use the DATETIMEOFFSET type.
The datetimeoffset value supports the following ranges:
- Date – 0001-01-01 to 9999-12-31
- Time – 00:00:00 to 23:59:59.9999999
The datetimeoffset value follows a format as shown:
The following are some properties of the datetimeoffset you should know:
- It supports user-defined second precision.
- It has an accuracy of 100 nanoseconds.
- Storage size of 10 bytes.
- It is not daylight saving aware
- Uses Gregorian calendar
The following table shows the precision scale for the datetimeoffset value.
The following shows the usage of the datetimeoffset type.
We can also use the datetimeoffset type in a table column as:
In this post, you learned the various concepts about the datetimeoffset data type in SQL Server. You also learned how to use it in variable definition and table creation.