This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes issue with java.sql.Timestamp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "issue with java.sql.Timestamp" Watch "issue with java.sql.Timestamp" New topic
Author

issue with java.sql.Timestamp

ajse ruku
Ranch Hand

Joined: May 06, 2005
Posts: 194
Hi ,

I am struggling with one issue.
In websphere 6.1/oracle10g , if i do java.sql.Timestamp.setTime(0) then its returning 1970-01-01 05:30:00.0

but the same code in weblogic/Oracle10g is working fine. For example if timestamp value is 2010-07-21 09:04:35.317 , its becoming
2010-07-21 09:04:35.0 after setTime(0).

Why websphere is returning 1970-01-01 05:30:00.0 , that i am failed to understand.

regards,
Ajse
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273

That time is the Epoch (in your timezone). Computers measure all dates and times from that day. So when you call setTime(0), you're saying "set this timestamp to be 0 milliseconds after the Epoch".


SCJP 6 || SCWCD 5
Vlado Zajac
Ranch Hand

Joined: Aug 03, 2004
Posts: 245
setTime(long time) shoud do this (according to docs):

Sets this Timestamp object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.

 
wood burning stoves
 
subject: issue with java.sql.Timestamp