Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Date Conversion Function Localtime to UTC (Java Wrapper)

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

From: <Andreas.Haunschmidt_at_voestalpine.com>
Date: Wed, 11 May 2005 08:58:11 +0200
Message-ID: <0F639AFBF6850240BCBADA6887DDDFCF02040B4E@mail02.vastahl.net>


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_at_weyerhaeuser.com] Sent: Wednesday, May 11, 2005 8:26 AM
To: Haunschmidt Andreas VAIG.TWI; oracle-l_at_freelists.org 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_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

and the inverse function
=3D20
  FUNCTION UTC2local(iDATE IN DATE)
  RETURN DATE IS 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
--
http://www.freelists.org/webpage/oracle-l


--
http://www.freelists.org/webpage/oracle-l
Received on Wed May 11 2005 - 03:02:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US