to_timestamp behaviour

From: Marcel Ruff <mr(at)marcelruff(dot)info>
To: pgsql-novice(at)postgresql(dot)org
Subject: to_timestamp behaviour
Date: 2013-01-29 19:44:46
Message-ID: 510826AE.4000402@marcelruff.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I do this ISO date query:

select to_timestamp('2012-07-06T23:17:39.668Z', 'YYYY-MM-DD\THH24:MI:SS.MS'),
'2012-07-06T23:17:39.668Z' AS ORIGINAL;

to_timestamp | original
----------------------------+--------------------------
2012-07-06 03:17:39.668+00 | 2012-07-06T23:17:39.668Z
(1 row)

the result for the hour is "03" instead of the expected "23"!

Trying without the valid 'T' as separator:

watchee=# select to_timestamp('2012-07-06T23:17:39.668', 'YYYY-MM-DD HH24:MI:SS.MSZ'),
'2012-07-06T23:17:39.668Z' AS ORIGINAL;
to_timestamp | original
----------------------------+--------------------------
2012-07-06 23:17:39.668+00 | 2012-07-06T23:17:39.668Z
(1 row)

it works fine.

Shouldn't the first variant be OK as well?

Thanks
Marcel

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2013-01-30 01:23:36 Re: to_timestamp behaviour
Previous Message Darryl Pye 2013-01-27 11:02:26 Schemas and views