From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | adam(dot)r(at)sbcglobal(dot)net |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: time math - Bug or expected behavior? |
Date: | 2008-08-27 03:11:55 |
Message-ID: | 2261.1219806715@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Adam Rich <adam(dot)r(at)sbcglobal(dot)net> writes:
> I traced a bug in our application down to this basic operation:
> set timezone to 'US/Eastern';
> select '11/02/2008'::timestamptz, '12:10'::time,
> '11/02/2008'::timestamptz + '12:10'::time;
> I have a date and a time stored separately and I want to combine them,
> and use them in some timezone-aware calculations. When I add the time
> 12:10 to the date 11/2/08, I expect the timestamp "11/2/08 12:10" but
> instead, I get "11/2/08 11:10".
I don't see why that surprises you in the least.
'11/02/2008'::timestamptz means 11/02/2008 00:00 local time, and (given
US DST rules) 11/2/08 11:10 is what the time will be 12 hours and 10
minutes later.
If you want non-DST-aware timekeeping, use timestamp without time zone.
> Still, I would have expected the above behavior
> when adding an interval to a timestamp, but not a time.
How could a time work differently from an interval in this context?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tino Wildenhain | 2008-08-27 06:09:28 | Re: Postgre connect on Postgre |
Previous Message | Adam Rich | 2008-08-27 02:39:00 | time math - Bug or expected behavior? |