From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Andrew Bartley" <abartley(at)evolvosystems(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: April 1 |
Date: | 2002-03-04 02:20:51 |
Message-ID: | 24284.1015208451@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Andrew Bartley" <abartley(at)evolvosystems(dot)com> writes:
> I'm having trouble calculating a date of April 1 2002.
What is the daylight savings transition day in your timezone?
(I'm betting March 31.)
> It seems as though the "+ interval('1 day'))" only adds 23 hours rather tha=
> n 24.
No, interval('1 day') is exactly 24 hours. But March 31 is longer than
24 hours. You're computing March 31 23:00 hours, and then truncating
that back to March 31.
If you want to calculate at the date level I'd suggest calculating with
dates, not timestamps.
regression=# select date('2002-03-31') + 1;
?column?
------------
2002-04-01
(1 row)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Samik Raychaudhuri | 2002-03-04 03:08:47 | Re: Conditional Statement |
Previous Message | Samik Raychauhduri | 2002-03-04 01:13:48 | Conditional Statement |