Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Date Conversion Function Localtime to UTC (Java Wrapper)
Not sure if this is exactly what you're looking for by I use it to convert=20
import java.util.*;
import java.text.*;
public class get_time {
public static final void main(String args[]) { if (args.length =3D=3D 1) {
ConvertUTC(args[0]);
} else {
System.out.println("Specific UTC time");
}
}
public get_time () {
}
public static String ConvertUTC(String sUTC) { final DateFormat format =3D DateFormat.getInstance();
String date =3D format.format(new Date(Long.parseLong(sUTC)));
System.out.println(date);
return (date);
}
}
I use this code to convert Unix time to a date format, I guess ConvertUTC is what you're really after.
For example:
java get_time 0001119999999999
and the output is:
6/28/05 4:06 PM
Thanks!=20
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of
Andreas.Haunschmidt_at_voestalpine.com
Sent: Tuesday, May 10, 2005 11:00 PM
To: oracle-l_at_freelists.org
Subject: Date Conversion Function Localtime to UTC (Java Wrapper)
Dear list members,
I'm looking for 2 functions like this:
FUNCTION local2UTC(iDATE IN DATE)
RETURN DATE IS
As I'm not a Java specialist and in order not to reinvent=3D20 the wheel, I'm hoping someone could give me a hint, or=3D20 - much appreciated:) - sample code.
Thanks in advance
-- Andreas -- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-lReceived on Wed May 11 2005 - 02:30:13 CDT
![]() |
![]() |