Re: how to show time zone with numerical offset in CSV log?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Zoet <Michael(dot)Zoet(at)zoet(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to show time zone with numerical offset in CSV log?
Date: 2015-09-22 15:22:09
Message-ID: 6681.1442935329@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Zoet <Michael(dot)Zoet(at)zoet(dot)de> writes:
> Can you explain what '<-0400>+4' exactly means?

It's a POSIX-style zone name specifying the STD abbreviation "-0400",
UTC offset 4 hours west of Greenwich, and no DST behavior.

> And why the string
> '<+0200>-2' prints the date & time with the correct time and +0200 for
> my time zone CEST?

Same thing for 2 hours east of Greenwich. Remember POSIX and ISO have
opposite sign conventions.

> And how can this automatically be changed if Germany switches from
> summer time (CEST with +0200) to winter time (CET +0100)?

Well, you could write <+0200>-2<+0100> but I'm not sure I would recommend
it. That would result in switching on the DST transition days specified
in the "posixrules" timezone database file, which by default will be USA
not European rules. You could replace the posixrules file with some
suitable European zone file, but that would be more invasive than you
might want (especially if the zone database is shared with non-Postgres
applications); and even if that's OK, it's practically certain you'd
forget to re-fix it after some future software update overwrites the zone
files.

The best compromise might be to just use <+0000>+0, ie force it to
print in GMT always.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Zoet 2015-09-22 15:42:52 Re: how to show time zone with numerical offset in CSV log?
Previous Message Michael Zoet 2015-09-22 15:16:38 Re: how to show time zone with numerical offset in CSV log?