day(date/timestamp value) extract day #
month(date/timestamp value) extract month #
year(date/timestamp value) extract year #
second(time/timestamp value) extract second #
minute(time/timestamp value) extract minute #
hour(time/timestamp value) extract hour #
intervaladd(interval-name, interval, date/time/timestamp)The intervaladd function adds an integer interval (interval) to a date, time or timestamp value (date/time/timestamp). interval-name is day, month, year, second, minute or hour. intervaladd returns a date, time or timestamp value of the same type as the third argument. The integer value may be negative.
Example (compute the timestamp 36 hours ago):
intervaladd(hour, -36, now)
intervaldiff(interval-name, date/time/timestamp, date/time/timestamp)The intervaldiff function computes the difference between two date, time and/or timestamp values. interval-name is day, month, year, second, minute or hour. intervaldiff returns an integer difference expressed as the interval specified by interval-name. If the second value is later than the first, the result will be negative.
For example:
intervaldiff(day, 1/1/2001, 1/1/2000)Returns 366.