Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.sql.Timestamp::getTime and SYSDATE

25915Oct 22 2003 — edited Oct 24 2003
I have a question regarding what is returned by the java.sql.Timestamp::getTime method.

- Create a Java stored procedure that looks something like:

import java.sql.Timestamp;
public class javatime {
public static long datenumber(java.sql.Timestamp timestamp) {
return timestamp.getTime() / 1000L;
}
}

(the divide by 1000L is just to convert from milliseconds to seconds)

- Run a SQL statement that looks something like:

select datenumber(SYSDATE) from dual;

We have noticed that on some Oracle installations (on Solaris in the Pacific timezone), the value returned is 3600 seconds (1 hour) greater although the SYSDATE values are the same. The OS TZ environment variables are the same, the values returned by DBTIMEZONE, SESSIONTIMEZONE and SYSTMESTAMP are the same. If you create a Java class that runs outside of the database that calls java.util.Data::getTime(), the values returned on the various machines are the same (and correct).

Any ideas as to what settings would be affecting the value returned by getTime?

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 21 2003
Added on Oct 22 2003
4 comments
963 views