@@ -9354,9 +9354,11 @@ SELECT EXTRACT(DOY FROM TIMESTAMP '2001-02-16 20:38:40');
93549354 <listitem>
93559355 <para>
93569356 For <type>timestamp with time zone</type> values, the
9357- number of seconds since 1970-01-01 00:00:00 UTC (can be negative);
9357+ number of seconds since 1970-01-01 00:00:00 UTC (negative for
9358+ timestamps before that);
93589359 for <type>date</type> and <type>timestamp</type> values, the
9359- number of seconds since 1970-01-01 00:00:00 local time;
9360+ nominal number of seconds since 1970-01-01 00:00:00,
9361+ without regard to timezone or daylight-savings rules;
93609362 for <type>interval</type> values, the total number
93619363 of seconds in the interval
93629364 </para>
@@ -9365,18 +9367,29 @@ SELECT EXTRACT(DOY FROM TIMESTAMP '2001-02-16 20:38:40');
93659367SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40.12-08');
93669368<lineannotation>Result: </lineannotation><computeroutput>982384720.12</computeroutput>
93679369
9370+ SELECT EXTRACT(EPOCH FROM TIMESTAMP '2001-02-16 20:38:40.12');
9371+ <lineannotation>Result: </lineannotation><computeroutput>982355920.12</computeroutput>
9372+
93689373SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');
93699374<lineannotation>Result: </lineannotation><computeroutput>442800</computeroutput>
93709375</screen>
93719376
93729377 <para>
9373- You can convert an epoch value back to a time stamp
9378+ You can convert an epoch value back to a <type>timestamp with time zone</type>
93749379 with <function>to_timestamp</function>:
93759380 </para>
93769381<screen>
93779382SELECT to_timestamp(982384720.12);
93789383<lineannotation>Result: </lineannotation><computeroutput>2001-02-17 04:38:40.12+00</computeroutput>
93799384</screen>
9385+
9386+ <para>
9387+ Beware that applying <function>to_timestamp</function> to an epoch
9388+ extracted from a <type>date</type> or <type>timestamp</type> value
9389+ could produce a misleading result: the result will effectively
9390+ assume that the original value had been given in UTC, which might
9391+ not be the case.
9392+ </para>
93809393 </listitem>
93819394 </varlistentry>
93829395
0 commit comments