Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f3f6737

Browse files
committed
Adjust extract(epoch) example to clarify that it includes fractional
seconds, per gripe from Richard Neill. Also, add a cross-reference to the to_timestamp function.
1 parent 9bd27b7 commit f3f6737

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

doc/src/sgml/func.sgml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.484 2009/08/03 21:11:39 joe Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.485 2009/08/10 16:10:19 tgl Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -6239,8 +6239,8 @@ SELECT EXTRACT(DOY FROM TIMESTAMP '2001-02-16 20:38:40');
62396239
</para>
62406240

62416241
<screen>
6242-
SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-08');
6243-
<lineannotation>Result: </lineannotation><computeroutput>982384720</computeroutput>
6242+
SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40.12-08');
6243+
<lineannotation>Result: </lineannotation><computeroutput>982384720.12</computeroutput>
62446244

62456245
SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');
62466246
<lineannotation>Result: </lineannotation><computeroutput>442800</computeroutput>
@@ -6250,10 +6250,13 @@ SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');
62506250
Here is how you can convert an epoch value back to a time
62516251
stamp:
62526252
</para>
6253-
62546253
<screen>
6255-
SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720 * INTERVAL '1 second';
6254+
SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720.12 * INTERVAL '1 second';
62566255
</screen>
6256+
<para>
6257+
(The <function>to_timestamp</> function encapsulates the above
6258+
conversion.)
6259+
</para>
62576260
</listitem>
62586261
</varlistentry>
62596262

0 commit comments

Comments
 (0)