| From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Cc: | "Cezariusz Marek" <cezariusz(dot)marek(at)comarch(dot)pl> | 
| Subject: | Re: How to get the time zone offset | 
| Date: | 2011-12-30 16:13:52 | 
| Message-ID: | 201112300813.52897.adrian.klaver@gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Friday, December 30, 2011 6:18:05 am Cezariusz Marek wrote:
> 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"
Maybe I am not understanding what you want, but why not:
select clock_timestamp()::text;
It gives you the format you want.
-- 
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nigel Heron | 2011-12-30 16:16:39 | Re: duplicate key errors when restoring 8.4.0 database dump into 9.1.2 | 
| Previous Message | Culley Harrelson | 2011-12-30 16:12:27 | Re: duplicate key errors when restoring 8.4.0 database dump into 9.1.2 |