Time and Date functions

Fauna has two special data types dealing with dates and times. The first data type is date which stores a calendar date. The second is a timestamp (ts) which stores an instant in time expressed as a calendar date and time of day. Timestamp can safely store nanoseconds precision, but be careful as many operating system clocks provide only microsecond precision. All Timestamps are stored in UTC. If a timestamp is inserted with a timezone (TZ), it is converted to UTC and the local timezone is not stored. The following functions allow the manipulation of dates and timestamps.

Date

Converts an ISO-8601 string into a Date.

DayOfMonth

Returns the day of the month from a timestamp.

DayOfWeek

Returns the day of the week from a timestamp.

DayOfYear

Returns the day of the year from a timestamp.

Epoch

Creates a timestamp from the number of seconds since 1970-01-01.

Hour

Returns the hour from a timestamp.

Minute

Returns the minute from a timestamp.

Month

Returns the month from a timestamp.

Second

Returns the second from a timestamp.

Time

Converts and ISO-8601 string into a timestamp.

Year

Returns the year from a timestamp.