to_timestamp behaviour - Mailing list pgsql-novice

From Marcel Ruff
Subject to_timestamp behaviour
Date
Msg-id 510826AE.4000402@marcelruff.info
Whole thread Raw
Responses Re: to_timestamp behaviour
List 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


pgsql-novice by date:

Previous
From: Darryl Pye
Date:
Subject: Schemas and views
Next
From: Tom Lane
Date:
Subject: Re: to_timestamp behaviour