Introducing Support for Timestamps

Published by xi on 2011-03-25

The initial 2.0 release only supported the date type. Recently, support for a datetime and time data types has been added.


These types provide the following set of operations.


Date and datetime literals use the ISO notation: YYYY-MM-DD and YYYY-MM-DD hh:mm:ss.sss.


Date and datetime values could also be constructed from individual fields.


You could convert a date to a datetime value and back.


Date, datetime and time values could be compared to each other.

Note that you cannot compare a date to a datetime value directly, you need to cast the values to the common type first.

Current date

Function today() returns the current date, now() returns the current date and time.


Functions year(), month(), day(), hour(), minute(), second() extract individual fields of a date or a datetime value.


Adding an integer N to a date value advances the date by N days. Similarly, a float number could be added to a datetime value to advanced it by the given number of days (the integer part) and time (the fractional part).

You could also subtract one date value from another to get the number of days between them.

Open questions

INTERVAL data type is not yet supported.

There is no way to advance a date by N months.

blog comments powered by Disqus