diff options
author | Tom Lane | 2009-08-10 16:10:19 +0000 |
---|---|---|
committer | Tom Lane | 2009-08-10 16:10:19 +0000 |
commit | f3f6737af9ef1f5dc96faed3ba564137f3bc4dc3 (patch) | |
tree | 48dd9fc9eb5d77294d5403db34aecf34998e9ef4 /doc/src | |
parent | 9bd27b7c9e998087f390774bd0f43916813a2847 (diff) |
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.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 4e5b08d8e43..4a890cb8b89 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.484 2009/08/03 21:11:39 joe Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.485 2009/08/10 16:10:19 tgl Exp $ --> <chapter id="functions"> <title>Functions and Operators</title> @@ -6239,8 +6239,8 @@ SELECT EXTRACT(DOY FROM TIMESTAMP '2001-02-16 20:38:40'); </para> <screen> -SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-08'); -<lineannotation>Result: </lineannotation><computeroutput>982384720</computeroutput> +SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40.12-08'); +<lineannotation>Result: </lineannotation><computeroutput>982384720.12</computeroutput> SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours'); <lineannotation>Result: </lineannotation><computeroutput>442800</computeroutput> @@ -6250,10 +6250,13 @@ SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours'); Here is how you can convert an epoch value back to a time stamp: </para> - <screen> -SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720 * INTERVAL '1 second'; +SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720.12 * INTERVAL '1 second'; </screen> + <para> + (The <function>to_timestamp</> function encapsulates the above + conversion.) + </para> </listitem> </varlistentry> |