Querying tibDateTime Columns
To perform a SQL query on a
tibDateTime column, the value of the
tibDateTime column is internally converted to a string of the form:
YYYY-MM-DD HH:MM:SS.SSSSSSSSSZWhere the ' SSSSSSSSS ' following ' SS. ' represent nanoseconds and 'Z' represents Coordinated Universal Time (UTC).
Since we do this internal conversion of tibDateTime column values, the SQL date and time functions which normally only work on ISO 8601 formatted strings can also be used on the converted tibDateTime values. The date and time functions are lenient with respect to the number of digits following the decimal in the fractional seconds, so the nine places of precision in the string representation of a tibDateTime value does not cause any issues.
The following are examples of queries which can be run on a column of type
datetime which contains a
tibDateTime object:
SELECT * FROM mytable WHERE dtm=’2016-01-01 00:00:00.000000000Z’ SELECT * FROM mytable WHERE date(dtm)=’2016-01-01’ SELECT * FROM mytable WHERE datetime(dtm)=’2016-01-01 00:00:00’
Copyright © Cloud Software Group, Inc. All rights reserved.