Rounding issue? They return similar but different values.
htp.print(trunc((sysdate - to_date('01-01-1970','dd-mm-yyyy'))*24*60*60));
htp.print(getTime);
Output:
1163687199
1163708799
Java Code for getTime:
CREATE OR REPLACE function getTime
RETURN VARCHAR2 AS LANGUAGE JAVA
NAME 'timeFormat.getTimeFormat() return java.lang.String';
/
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "timeFormat" AS
import java.util.*;
public class timeFormat
{
public String getTimeFormat(Date time)
{
// Create a buffer in which to format the data to sign.
StringBuffer buffer = new StringBuffer();
// Add the appropriately formatted time stamp. Note that
// the time stamp is expressed in seconds, not milliseconds.
buffer.append(time.getTime() / 1000);
return buffer.toString();
}
public static String getTimeFormat()
{
timeFormat timeFormat = new timeFormat();
Date now = new Date();
String returnValue = timeFormat.getTimeFormat(now);
return returnValue;
}
}
;
/
[Updated on: Thu, 16 November 2006 14:27]
Report message to a moderator