Date and time data types#
Querona supports the full set of SQL date and time data types, except data types with timezone. In most cases, a combination of DATE, DATETIME, SMALLDATETIME, TIME complete range of date/time functionality required by any application. Find all the details below.
Date and Time#
date
datetime2
smalldatetime
datetime
time
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';
datetime#
Defines a date that is combined with a time of day with fractional seconds that is 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';
datetime2#
Defines a date that is combined with a time of day that is based on 24-hour clock. datetime2 can be considered as an extension of the existing datetime type that has 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 +02:30' AS datetime2(7)) AS 'datetime2';
smalldatetime#
Defines a date that is 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 a 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';