Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Convert to UTC Time Stamp in Long Form (YYYYMMDDhhmmssmmmuuun)

800742Aug 6 2010 — edited Aug 7 2010
Dear experts,

From sap perspective if i use function module CONVERT_INTO_TIMESTAMP on my PI box,
for CET (germany),i get following timestamp.I need to do as alternate in java.Exhausted using various classes but
could not achieve this timestamp.

Date Timestamp
05.08.2010 should be 20.100.804.220.000

Plz suggest how to get this ?
import java.text.DateFormat; 
import java.text.SimpleDateFormat;
import java.util.*;
public class DateConvert 
{
public static void main (String args[])
{
String startTime = new String("05.08.2010");
DateFormat formatter = new SimpleDateFormat("dd.mm.yyyy");
try {
                        Date d = formatter.parse(startTime);
                        SimpleDateFormat sdf  = new SimpleDateFormat();
                        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
                        System.out.println(sdf.format(d));
                        Date ds = new Date(sdf.format(d));
                        System.out.println(ds.getTime());
}
catch(Exception gh)
{
gh.printStackTrace();
}
 

}
}
Edited by: Adi1000 on Aug 5, 2010 11:28 PM

Edited by: Adi1000 on Aug 5, 2010 11:54 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2010
Added on Aug 6 2010
6 comments
1,047 views