Postgres UTC date format and epoch listing, sign inversion

Can someone explain to me this inversion of the sign, I'm lost here ...

SELECT EXTRACT(EPOCH FROM '01-01-1970 00:00:00 UTC+01'::timestamp with time zone)

=> 3600

SELECT EXTRACT(EPOCH FROM '1970-01-01 00:00:00+01'::timestamp with time zone)

=> -3600

Postgres 8.3.14

+5
source share
1 answer

it

1970-01-01 00:00:00+01

is an ISO 8601 timestamp with an offset of +1 hour , and +1 means east of Greenwich. Displacements in these

01-01-1970 00:00:00 UTC+01
1970-01-01 00:00:00 UTC+01
1970-01-01 00:00:00 XXX+01
1970-01-01 00:00:00 HAHA+01
1970-01-01 00:00:00 Pancakes+01

will be interpreted as POSIX-style timestamps , where +1 means west of Greenwich:

PostgreSQL will accept POSIX timezone specifications of the form STDoffset or STDoffsetDST, where STD is the abbreviation of the zone, the offset is the numeric offset in hours west of UTC

:

, POSIX , . , SET TIMEZONE TO FOOBAR0 , , UTC. , , , POSIX . PostgreSQL ISO-8601, .

.

+5

All Articles