Skip to main content

Date

NameAliasesDescription
DATECalendar date (year, month, day)

A date specifies a combination of year, month and day. SereneDB follows the SQL standard's lead by counting dates exclusively in the Gregorian calendar, even for years before that calendar was in use. Dates can be created using the DATE keyword, where the data must be formatted according to the ISO 8601 format (YYYY-MM-DD).

Query
SELECT DATE '1992-09-20';
Result
 date------------ 1992-09-20

Special Values

There are also three special date values that can be used on input:

Input stringDescription
epoch1970-01-01 (Unix system day zero)
infinityLater than all other dates
-infinityEarlier than all other dates

The values infinity and -infinity are specially represented inside the system and will be displayed unchanged, while epoch is simply a notational shorthand that will be converted to the date value when read. Casting these special values to VARCHAR shows their textual representation:

Query
SELECT    '-infinity'::DATE::TEXT AS negative,    'epoch'::DATE::TEXT AS epoch,    'infinity'::DATE::TEXT AS positive;
Result
 negative  | epoch      | positive-----------+------------+---------- -infinity | 1970-01-01 | infinity

Functions

See Date Functions.

This page contains: