1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
Date and Time Functions
=======================
.. toctree::
:hidden:
current_time_functions
extract_date_functions
date_trunc
Current
-------
For examples of the following, see :doc:`current_time_functions`.
+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+
|Name |Return Type |Description |
+===================================+=====================================+=================================================================+
|current_date |date |Current date |
+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+
|current_time |time with time zone |Current time of day |
+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+
|current_timestamp |timestamp with time zone |Current date and time (start of current transaction) |
+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+
|localtime |time |Current time of day |
+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+
|localtimestamp |timestamp |Current date and time (start of current transaction) |
+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+
|now() |timestamp with time zone |Current date and time (start of current transaction) |
+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+
|statement_timestamp() |timestamp with time zone |Current date and time (start of current statement) |
+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+
Extract
-------
For examples of the following, see :doc:`extract_date_functions`.
+--------------------------------+-----------------------+---------------------------------------+
|Name |Return Type |Description |
+================================+=======================+=======================================+
|extract(field from timestamp) |double precision |Get subfield |
+--------------------------------+-----------------------+---------------------------------------+
|extract(field from interval) |double precision |Get subfield |
+--------------------------------+-----------------------+---------------------------------------+
|date_part(text, timestamp) |double precision |Get subfield (equivalent to extract) |
+--------------------------------+-----------------------+---------------------------------------+
|date_part(text, interval) |double precision |Get subfield (equivalent to extract) |
+--------------------------------+-----------------------+---------------------------------------+
DATE TRUNC
-----------
For an example of the following, see :doc:`date_trunc`.
+--------------------------------+-----------------------+---------------------------------------+
|Name |Return Type |Description |
+================================+=======================+=======================================+
|date_trunc(text, timestamp) |timestamp |Truncate to specified precision |
+--------------------------------+-----------------------+---------------------------------------+
|