Search Postgresql Archives

Re: Daylight saving time question

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

 



Bayless Kirtley wrote:
Thanks Tom and Scott. You got me looking in the right direction. In this case the client and server are on the same machine (testing/development) and psql does return the right result. I tried all the possibilities from the java program, "show timezone", "select current_time" and "select current_timestamp". These
were all JDBC queries. When I used result.getString(), the values looked
right. When I used result.getTime(), they were off by one hour as if daylight saving were not in effect.

If 'result' is a Java 'java.util.Date' type (or one of its java.sql subtypes), then it only holds milliseconds since epoch as if in GMT; 'Date' holds no timezone information as such. In that situation, 'result.getTime()' returns a 'long' value.

How exactly are you displaying 'result.getTime()'? How exactly are you determining that its value is "off" by one hour? Can you show us Java code?

Is this a flaw in the JDBC driver or is that the expected behavior? In either case I do now have a workaround but would like to know.

It is not a flaw in the JDBC driver.

--
Lew

--
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