age(timestamp, timestamp) |
interval |
"Symbolic" result after subtracting the arguments, using years and months, not just days |
age(timestamp '2001-04-10', timestamp '1957-06-13') |
43 years 9 mons 27 days |
age(timestamp) |
interval |
From thecurrent_dateResult after subtracting the arguments (at midnight) |
age(timestamp '1957-06-13') |
43 years 8 mons 3 days |
clock_timestamp() |
timestamp with time zone |
Current timestamp of the real-time clock (changes during statement execution) |
|
|
current_date |
date |
Current date; |
|
|
current_time |
time with time zone |
Current time of day; |
|
|
current_timestamp |
timestamp with time zone |
Timestamp at the start of the current transaction; |
|
|
date_part(text, timestamp) |
double precision |
Extract subfield (equivalent toextract); |
date_part('hour', timestamp '2001-02-16 20:38:40') |
20 |
date_part(text, interval) |
double precision |
Extract subfield (equivalent toextract); |
date_part('month', interval '2 years 3 months') |
3 |
date_trunc(text, timestamp) |
timestamp |
Truncate to the specified precision; |
date_trunc('hour', timestamp '2001-02-16 20:38:40') |
2001-02-16 20:00:00 |
date_trunc(text, interval) |
interval |
Extract the specified precision, |
date_trunc('hour', interval '2 days 3 hours 40 minutes') |
2 days 03:00:00 |
extract(field from timestamp) |
double precision |
Extract subfield; |
extract(hour from timestamp '2001-02-16 20:38:40') |
20 |
extract(field from interval) |
double precision |
Extract subfield; |
extract(month from interval '2 years 3 months') |
3 |
isfinite(date) |
boolean |
Test whether it is a finite date (not +/-infinity) |
isfinite(date '2001-02-16') |
true |
isfinite(timestamp) |
boolean |
Test whether it is a finite timestamp (not +/-infinity) |
isfinite(timestamp '2001-02-16 21:28:30') |
true |
isfinite(interval) |
boolean |
Test whether it is a finite interval |
isfinite(interval '4 hours') |
true |
justify_days(interval) |
interval |
Adjust an interval according to 30 days per month |
justify_days(interval '35 days') |
1 mon 5 days |
justify_hours(interval) |
interval |
Adjust an interval according to 24 hours per day |
justify_hours(interval '27 hours') |
1 day 03:00:00 |
justify_interval(interval) |
interval |
Usejustify_daysandjustify_hoursAdjust an interval along with its sign |
justify_interval(interval '1 mon -1 hour') |
29 days 23:00:00 |
localtime |
time |
Current time of day; |
|
|
localtimestamp |
timestamp |
Timestamp at the start of the current transaction; |
|
|
make_date(year int, month int, day int) |
date |
Create a date from year, month, and day fields |
make_date(2013, 7, 15) |
2013-07-15 |
make_interval(years int DEFAULT 0, months int DEFAULT 0, weeks int DEFAULT 0, days int DEFAULT 0, hours int DEFAULT 0, mins int DEFAULT 0, secs double precision DEFAULT 0.0) |
interval |
Create an interval from year, month, week, day, hour, minute, and second fields |
make_interval(days := 10) |
10 days |
make_time(hour int, min int, sec double precision) |
time |
Create a time from hour, minute, and second fields |
make_time(8, 15, 23.5) |
08:15:23.5 |
make_timestamp(year int, month int, day int, hour int, min int, sec double precision) |
timestamp |
Create a timestamp from year, month, day, hour, minute, and second fields |
make_timestamp(2013, 7, 15, 8, 15, 23.5) |
2013-07-15 08:15:23.5 |
make_timestamptz(year int, month int, day int, hour int, min int, sec double precision, [ timezone text ]) |
timestamp with time zone |
Create a timestamp with time zone from year, month, day, hour, minute, and second fields. If not specifiedtimezone, the current time zone is used. |
make_timestamptz(2013, 7, 15, 8, 15, 23.5) |
2013-07-15 08:15:23.5+01 |
now() |
timestamp with time zone |
Timestamp at the start of the current transaction; |
|
|
statement_timestamp() |
timestamp with time zone |
Current timestamp of the real-time clock; |
|
|
timeofday() |
text |
The difference betweenclock_timestampSame, but the result is atext string; |
|
|
transaction_timestamp() |
timestamp with time zone |
Timestamp at the start of the current transaction; |
|
|