Discussion:
[DOCS] Indicated Epoch 0 is incorrect
(too old to reply)
i***@thepathcentral.com
2016-06-03 23:44:04 UTC
Permalink
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.1/static/functions-datetime.html
Description:

Per /docs/current/static/functions-datetime.html (and earlier), epoch is
defined as:

"For date and timestamp values, the number of seconds since 1970-01-01
00:00:00 UTC".

The correct value to obtain 0 is as follows:

SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '1970-01-01 8:00:00.0')
--
Sent via pgsql-docs mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://
Steve Crawford
2016-06-07 15:14:04 UTC
Permalink
The docs are correct. When you convert a string to a timestamp with time
zone it will interpret the string in *your* time zone which is apparently
offset from UTC.

Try:
select extract(epoch from timestamp with time zone '1970-01-01
00:00:00-00');
or
select extract(epoch from timestamp with time zone '1970-01-01 00:00:00
UTC');

Note the explicit definition of timezone offset of zero or time zone of UTC.

Cheers,
Steve
Post by i***@thepathcentral.com
Page: https://www.postgresql.org/docs/9.1/static/functions-datetime.html
Per /docs/current/static/functions-datetime.html (and earlier), epoch is
"For date and timestamp values, the number of seconds since 1970-01-01
00:00:00 UTC".
SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '1970-01-01
8:00:00.0')
--
http://www.postgresql.org/mailpref/pgsql-docs
Loading...