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: Khemmanivanh, Somckit <somckit.khemmanivanh_at_weyerhaeuser.com>
Date: Tue, 10 May 2005 23:25:39 -0700
Message-ID: <65C0D8935651CB4D96E97CEFAC5A12B90A5B86@wafedixm10.corp.weyer.pri>

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 - 02:30:13 CDT

Original text of this message

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