cancel
Showing results for 
Search instead for 
Did you mean: 

get the start time stamp in WD application

0 Kudos

Hi Colleagues,

do you know a method which can be called in a WD application to get a time stamp?

Thanks and regards,

Nada

Accepted Solutions (0)

Answers (7)

Answers (7)

0 Kudos

thanks a lot! I will try it

former_member182372
Active Contributor
0 Kudos

don`t forget to close the thread in case the problem is solved.

0 Kudos

the java converted type should be BigDecimal. That is the java type generated from ABAP type DEC15.

former_member182372
Active Contributor
0 Kudos

new BigDecimal(formatedDateToJCo);

0 Kudos

Yes I have tried it but I get the time stamp in string format not in a DEC15 format.

former_member182372
Active Contributor
0 Kudos

What Java type do you need? long?

try this:


long DEC15 = Long.parseLong(formatedDateToJCo);

0 Kudos

Thanks!

What I would need ist a get-Method which delivers me the system (current) date in UTC format(JJJJMMTThhmmss)

Regards,

Nada

former_member182372
Active Contributor
0 Kudos

This code is doing exactly what you need:


SimpleDateFormat format = new SimpleDateFormat("yyyyMMddkkmmss");
 
String formatedDateToJCo = format.format(new Date()); 

0 Kudos

Tnanks for your answer!

but how to get the UTC date? Is there an API for this?

Best regards,

Nada

former_member182372
Active Contributor
0 Kudos

Hi Nada,

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html

<i>Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. Nearly all modern operating systems assume that 1 day = 24 &#215; 60 &#215; 60 = 86400 seconds in all cases. In UTC, however, about once every year or two there is an extra second, called a "leap second." The leap second is always added as the last second of the day, and always on December 31 or June 30. For example, the last minute of the year 1995 was 61 seconds long, thanks to an added leap second. Most computer clocks are not accurate enough to be able to reflect the leap-second distinction</i>

Best regards, Maksim Rashchynski.

0 Kudos

Thanks a lot!

What I would need is exacly the backend value from type TZNTSTMPS.

former_member182372
Active Contributor
0 Kudos

Hi Nada,

As TZNTSTMPS is "UTC Time Stamp in Short Form (YYYYMMDDhhmmss)" than you have to use SimpleDateFormat:


SimpleDateFormat format = new SimpleDateFormat("yyyyMMddkkmmss");

String formatedDateToJCo = format.format(new Date()); 

Check this too:

https://media.sdn.sap.com/javadocs/NW04/SPS15/jc/com/sap/mw/jco/JCO.Field.html

http://help.sap.com/saphelp_nw04/helpdata/en/9a/20e23d44d48e5be10000000a114084/frameset.htm

http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html

Best regards, Maksim Rashchynski.

former_member182372
Active Contributor
0 Kudos

Hi Nada,

Check http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Timestamp.html

new Timestamp(System.currentTimeMillis()); 

Best regards, Maksim Rashchynski.