java.sql.Timestamp::getTime and SYSDATE
25915Oct 22 2003 — edited Oct 24 2003I 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