Search Postgresql Archives

Re: Thoroughly confused about time zones

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

 



I think maybe I’m making things much more difficult than they need to be.  I tried this:

 

select cast (extract(epoch from ('2010-3-14 12:00'::timestamp - '2010-3-13 12:00'::timestamp)) as integer) / 60 / 60

 

and got 24.  The difference between timestamps without time zones is 24 hours, even though the interval spanned a time change.

 

But when I tried this:

 

select cast (extract(epoch from ('2010-3-14 12:00'::timestamptz - '2010-3-13 12:00'::timestamptz)) as integer) / 60 / 60

 

I got 23, showing that even if I did not specify what time zone I’m talking about, I got the correct answer.

 

 

RobR


[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