RE: Date Conversion Function Localtime to UTC (Java Wrapper)

  • From: <Andreas.Haunschmidt@xxxxxxxxxxxxxxx>
  • To: <somckit.khemmanivanh@xxxxxxxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 11 May 2005 08:58:11 +0200

Thanks for the quick reply,
I'm going to try to make a PL/SQL wrapper for it...

Andreas

-----Original Message-----
From: Khemmanivanh, Somckit
[mailto:somckit.khemmanivanh@xxxxxxxxxxxxxxxx]
Sent: Wednesday, May 11, 2005 8:26 AM
To: Haunschmidt Andreas VAIG.TWI; oracle-l@xxxxxxxxxxxxx
Subject: 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@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of
Andreas.Haunschmidt@xxxxxxxxxxxxxxx
Sent: Tuesday, May 10, 2005 11:00 PM
To: oracle-l@xxxxxxxxxxxxx
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
  -- 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;

Someone told me there is a Java class (java.calender) which
could help doing that. It should be possible then to use it
in PL/SQL (server side Oracle 9.2) by wrapping it.

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
--
//www.freelists.org/webpage/oracle-l


--
//www.freelists.org/webpage/oracle-l

Other related posts: