summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2009-08-10 16:10:19 +0000
committerTom Lane2009-08-10 16:10:19 +0000
commitba94293d6111a67ca82bb99c0e201055953dd74b (patch)
treec4d6f80798d657ae635957ac14bdccce3d98c5a9
parent49d79c0d4058caf2feda2c9b7d80f4374201558b (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.
-rw-r--r--doc/src/sgml/func.sgml11
1 files changed, 7 insertions, 4 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 89c752f516..942dcbd340 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -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>