cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Time in Milliseconds

Nikhil_Makhija
Participant
0 Kudos

Hello All,

Is there any function available in BLS to parse input datetime to datetime in milliseconds? As per datefunction in MII it always round up to HH:mm:ss

e.g.  HH:mm:ss.SSS = 11:10:08.000 in MII , any pointers how to get time in millisec?

Thanks

Nikhil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nikhil,

To get the last time digits in millisecond you can use the function Aravinth said.

datefromxmlformat(datenow, "dd-MM-yyyy hh:mm:ss.SSS")

and if you need 2 digit milisec value then you can use "stringleft(stringValue, newStringLength)" function on top of it so that you will get the 2 digit value.

But Just to add one point, by using "SSS" you will get the time difference of 24:00:00 and current time into millisecond format.

So if you want to use millisecond for the uniqueness of the data then it is ok, but if you want to use it for a proper millisecond interval (1000 division of 1 sec) then it will be better to use any other approach.

Hope it will help you.

Regards,

Suman

Nikhil_Makhija
Participant
0 Kudos

Thanks All for your response -

I used other approach to pass time in miliseconds from UI rather to convert in BLS to do my calculations.

Regards

Nikhil

Answers (3)

Answers (3)

Former Member
0 Kudos

Nikhil,

SAP MII 12.x or SAP MII 14.0 Help says:

The system does not use the millisecond portion of a date and time string instead, it returns 0. If you are using the string HH:mm:ss.SSS and have a date and time value of 14:25:05.123, this value is converted to 14 hours, 25 minutes, and 5 seconds. If you try to output the value using the format hh:mm:ss.S aa, the system returns 02:25:05.0 PM.

BR

Pedro Iglesias

aravinth_anandhan
Active Participant
0 Kudos

Hi,

datefromxmlformat(datenow, "dd-MM-yyyy hh:mm:ss.SSS")

Use the above function to get date with milliseconds.  If you have date value in variable, replace datenow with your variable name. But, I have tested the above function and it is always giving me a millisecond value as 000 .

former_member204240
Active Participant
0 Kudos

Try using below function

formatdatenow("HH:mm:ss.S")

If you have different date other than current date use second(date) function and multiply by 1000 to get milli second.

Regards,

Padma