Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ORA-29531 Error - and the method is declared both PUBLIC and STATIC
Thank you for your assistance. I made a minor change because it was
truncating the date to the nearest hour.
Jeff
Here it the code, in case anyone else needs similar functionality.
Java Source
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "TimeZoneFormatter" AS
import java.util.TimeZone; import java.sql.Timestamp; import java.text.SimpleDateFormat;
public class TimeZoneFormatter {
public static String Convert(String clientTimezone, Timestamp
clientDate)
{
SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/DD/yyyy
HH:mm:ss");
//DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
TimeZone timeZoneClient = TimeZone.getTimeZone(clientTimezone);
dateFormatter.setTimeZone(timeZoneClient);
return dateFormatter.format(clientDate);
}
}
PL/SQL Wrapper
CREATE OR REPLACE function TimeZoneFormatter (ClientTimezone varchar2,
ClientDate Date)
return varchar2 as
language java
name 'TimeZoneFormatter.Convert(java.lang.String, java.sql.Timestamp)
return java.lang.String';
SQLPLUS Output
select sysdate, TimeZoneFormatter('Europe/Paris', sysdate) from dual;
SYSDATE
1 row selected. Received on Mon Mar 14 2005 - 12:30:04 CST
![]() |
![]() |