How to get the time zone offset

From: "Cezariusz Marek" <cezariusz(dot)marek(at)comarch(dot)pl>
To: <pgsql-general(at)postgresql(dot)org>
Subject: How to get the time zone offset
Date: 2011-12-30 14:18:05
Message-ID: 4C34142AB3B44772B03966B9B9D5632F@co382.comarch.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I need to convert timestamp to a format with a time zone offset, like this:

select clock_timestamp()::text;

and it returns the following value:

"2011-12-30 11:59:06.538+01"

What is the default format for timestamp::text conversion? I've tried this:

select to_char(clock_timestamp(), 'YYYY-MM-DD HH24:MI:SSTZ');

But it gives me "CET" instead of "+01":

"2011-12-30 11:59:06CET"

--
____________________________________________________________________
Cezariusz Marek                   mob: +48 608 646 494
http://www.comarch.com/   tel: +48 33 815 0734
____________________________________________________________________

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Culley Harrelson 2011-12-30 14:32:56 duplicate key errors when restoring 8.4.0 database dump into 9.1.2
Previous Message Cezariusz Marek 2011-12-30 14:07:34 How to get the time zone offset