public inbox for [email protected]  
help / color / mirror / Atom feed
Indicated Epoch 0 is incorrect
2+ messages / 2 participants
[nested] [flat]

* Indicated Epoch 0 is incorrect
@ 2016-06-03 23:44 [email protected]
  2016-06-07 15:14 ` Re: Indicated Epoch 0 is incorrect Steve Crawford <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: [email protected] @ 2016-06-03 23:44 UTC (permalink / raw)
  To: pgsql-docs

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:

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

The correct value to obtain 0 is as follows:

SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE &#39;1970-01-01 8:00:00.0&#39;)

-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Indicated Epoch 0 is incorrect
  2016-06-03 23:44 Indicated Epoch 0 is incorrect [email protected]
@ 2016-06-07 15:14 ` Steve Crawford <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Steve Crawford @ 2016-06-07 15:14 UTC (permalink / raw)
  To: [email protected]; +Cc: pgsql-docs

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

On Fri, Jun 3, 2016 at 4:44 PM, <[email protected]> wrote:

> 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:
>
> &quot;For date and timestamp values, the number of seconds since 1970-01-01
> 00:00:00 UTC&quot;.
>
> The correct value to obtain 0 is as follows:
>
> SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE &#39;1970-01-01
> 8:00:00.0&#39;)
>
> --
> Sent via pgsql-docs mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-docs
>


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-06-07 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-06-03 23:44 Indicated Epoch 0 is incorrect [email protected]
2016-06-07 15:14 ` Steve Crawford <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox