Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Date Conversion Function Localtime to UTC (Java Wrapper)
Hi Andreas
>I'm looking for 2 functions like this:
>
> FUNCTION local2UTC(iDATE IN DATE)
> RETURN DATE IS
> -- Returns UTC for iDATE in localtime
> BEGIN
> ...
> END;
>
>and the inverse function
>=3D20
> FUNCTION UTC2local(iDATE IN DATE)
> RETURN DATE IS
> -- Returns localtime for iDATE in UTC
> BEGIN
> ...
> END;
Just some thoughts...=20
If the timezone is correctly configured on your machine with a select = like the following you get the difference between your local time and = GMT: SQL> SELECT tz_offset(dbtimezone) FROM dual;
TZ_OFFS
If this is the case you could use the following select to do a = conversion of the local time to GMT:
SQL> SELECT cast(sysdate AS TIMESTAMP) local,
2 from_tz(cast(sysdate AS TIMESTAMP), tz_offset(dbtimezone)) 3 AT TIME ZONE 'GMT' gmt
LOCAL GMT ------------------------------ ------------------------------ 11-MAY-05 10.15.57.000000 11-MAY-05 09.15.57.000000 GMT
HTH
Chris
-- http://www.freelists.org/webpage/oracle-lReceived on Wed May 11 2005 - 04:24:04 CDT
![]() |
![]() |