| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | lstrupinskaya(at)gmail(dot)com |
| Cc: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: BUG #12739: to_timestamp function conver string to time incorrectly |
| Date: | 2015-02-06 23:12:49 |
| Message-ID: | 27550.1423264369@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
lstrupinskaya(at)gmail(dot)com writes:
> When trying to use to_timestamp function to convert string '3/10/2013 2:30'
> to timestamp it was actually converted into 3/10/2013 3:30.
> Below is select statement:
> select to_timestamp('3/10/2013 2:30','MM/DD/YYYY HH24:MI');
If you're running with USA DST rules, there was no such thing as 2:30
observed local time on that date: clocks advanced from 1:59:59 to 3:00:00.
As documented, Postgres handles invalid or ambiguous times near a DST
transition by supposing that the given time is local standard time.
So in the New York zone for instance, 2:30 local standard time (GMT-5)
would equate to 3:30 local daylight time (GMT-4), and daylight time would
have been what was observed at that instant, so that's what gets printed.
If you don't want DST-aware handling of timestamps, don't use type
timestamptz nor to_timestamp (which actually produces timestamptz).
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Elijah Zupancic | 2015-02-07 00:16:50 | Fwd: [BUGS] pg_dump search path issue |
| Previous Message | Tom Lane | 2015-02-06 22:39:23 | Re: Function parameter type precision modifiers ignored. |