Search Postgresql Archives

Re: Inconsistent time interval formatting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allen Chen <rocklob@xxxxxxxxx> writes:
>> That won't really help.  The fundamental point here is that '1 day' is
>> not the same concept as '24 hours', because of DST changes; and the
>> interval type treats them as different.

> I don't understand how DST changes matter for a time interval or how that
> could even be factored into calculations.  Could you elaborate on that?

The main case where it matters is timestamp plus or minus interval.
As an example, 2011-03-13 is a DST transition day where I live.  So:

regression=# select '2011-03-13 01:00'::timestamptz;
      timestamptz       
------------------------
 2011-03-13 01:00:00-05
(1 row)

regression=# select '2011-03-13 01:00'::timestamptz + '1 day'::interval;
        ?column?        
------------------------
 2011-03-14 01:00:00-04
(1 row)

regression=# select '2011-03-13 01:00'::timestamptz + '24 hours'::interval;
        ?column?        
------------------------
 2011-03-14 02:00:00-04
(1 row)

"Add 1 day" means "produce the same local time on the next day", whereas
"add 24 hours" means exactly that.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux