Skip site navigation (1) Skip section navigation (2)

timestamp issues

From: Charl Gerber <charlgerber(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: timestamp issues
Date: 2005-03-10 14:03:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
I have a machine physically located in the USA, but
the OS (Linux) time is set to New Zealand time. So if
I execute "date" on the command prompt, I get the New
Zealand time.

I have java classes converting all time to timezone

I have tables with "TIMESTAMP" fields (no timezone).

If I do this (through a JDBC call):

"UPDATE users SET last_login=current_timestamp"

then the database explorer shows the times in New
Zealand time, as expected. But my the Java classes see
the time (after converting the time to the Amsterdam
timezone) as 19 hours ahead of Amsterdam time. (19
hours is, I think, the difference between the USA and
New Zealand times?). I also tried with LOCALTIMESTAMP
instead of current_timestamp, same result.

If, however, I change the update to this:

"UPDATE users SET last_login=?"
prepareStatement.setTimestamp(1, new Timestamp(

Then the java classes see the time correct as it

Why is this? Why does System.currentTimeMillis() and
current_time give different times?


pgsql-jdbc by date

Next:From: Scott MarloweDate: 2005-03-10 20:38:53
Subject: Re: PostGreSQL Date Query?
Previous:From: PrasanthDate: 2005-03-09 22:49:33
Subject: Re: Crystal Reports: Connection rejected: FATAL: no PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group