wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 193
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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: issue with java.sql.Timestamp
 
Similar Threads
Calendar() / Date() bug ???
How to print all the fields in a record
Java Calendar Dates
Problem moving columns and rows in 2D array.
Java Calendar Dates