1
Date and Time Functions
2
=======================
14
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
15
|Name |Return Type |Description |
16
+==========================+=====================================+=================================================================+
17
|current_date |date |Current date |
18
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
19
|current_time |time with time zone |Current time of day |
20
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
21
|current_timestamp |timestamp with time zone |Current date and time (start of current transaction) |
22
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
23
|localtime |time |Current time of day |
24
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
25
|localtimestamp |timestamp |Current date and time (start of current transaction) |
26
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
27
|now() |timestamp with time zone |Current date and time (start of current transaction) |
28
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
29
|statement_timestamp() |timestamp with time zone |Current date and time (start of current statement) |
30
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
31
|timeofday() |text |Current date and time (as a text string) |
32
+--------------------------+-------------------------------------+-----------------------------------------------------------------+
38
+--------------------------------+-----------------------+---------------------------------------+
39
|Name |Return Type |Description |
40
+================================+=======================+=======================================+
41
|extract(field from timestamp) |double precision |Get subfield |
42
+--------------------------------+-----------------------+---------------------------------------+
43
|extract(field from interval) |double precision |Get subfield |
44
+--------------------------------+-----------------------+---------------------------------------+
45
|date_part(text, timestamp) |double precision |Get subfield (equivalent to extract) |
46
+--------------------------------+-----------------------+---------------------------------------+
47
|date_part(text, interval) |double precision |Get subfield (equivalent to extract) |
48
+--------------------------------+-----------------------+---------------------------------------+
54
+--------------------------------+-----------------------+---------------------------------------+
55
|Name |Return Type |Description |
56
+================================+=======================+=======================================+
57
|date_trunc(text, timestamp) |timestamp |Truncate to specified precision |
58
+--------------------------------+-----------------------+---------------------------------------+