Date and time#
Querona supports the SQL Server date and time types — date, datetime2, datetime,
smalldatetime and time — which together cover the date and time needs of most applications.
The time-zone-aware datetimeoffset type is not supported.
date#
Defines a date in Querona.
Syntax#
date
Description#
Property |
Description |
|---|---|
Range |
0001-01-01 through 9999-12-31 |
Accuracy |
1 day |
Example#
SELECT CAST('2017-05-04' AS date) AS 'date';
datetime2#
Defines a date combined with a time of day, based on a 24-hour clock. datetime2 is an extension of
datetime with a larger date range, a larger default fractional precision, and optional
user-specified precision.
Syntax#
datetime2 [ (fractional seconds precision) ]
Description#
Property |
Description |
|---|---|
Date range |
0001-01-01 through 9999-12-31 |
Time range |
00:00:00 through 23:59:59.9999999 |
Accuracy |
100 nanoseconds |
Example#
SELECT CAST('2017-05-04 15:55:44.1234567' AS datetime2(7)) AS 'datetime2';
datetime#
Defines a date combined with a time of day with fractional seconds, based on a 24-hour clock.
Syntax#
datetime
Description#
Property |
Description |
|---|---|
Date range |
1753-01-01 through 9999-12-31 |
Time range |
00:00:00 through 23:59:59.997 |
Accuracy |
Rounded to increments of .000, .003, or .007 seconds |
Example#
SELECT CAST('2017-05-04 15:55:44.132' AS datetime) AS 'datetime';
smalldatetime#
Defines a date combined with a time of day. The time is based on a 24-hour day, with seconds always zero (:00) and without fractional seconds.
Syntax#
smalldatetime
Description#
Property |
Description |
|---|---|
Date range |
1900-01-01 through 2079-06-06 |
Time range |
00:00:00 through 23:59:59 |
Accuracy |
One minute |
Example#
SELECT CAST('2017-05-04 15:55:44.132' AS smalldatetime) AS 'smalldatetime';
time#
Defines a time of day. The time is without time-zone awareness and is based on a 24-hour clock.
Syntax#
time [ (fractional second precision) ]
Description#
Property |
Description |
|---|---|
Range |
00:00:00.0000000 through 23:59:59.9999999 |
Accuracy |
100 nanoseconds |
Example#
SELECT CAST('2017-05-04 15:55:44.132' AS time(7)) AS 'time';