Need time in hh:mm:ss:ms

Vichitra Garg
Mega Expert

Hi,

I need to extract the time in below format - 

hh:mm:ss:ms

i.e I require milseconds also to be dispalyed along with hours/minutes/seconds. 

Please suggest the approach.

Thanks

1 ACCEPTED SOLUTION

Hi,

Can you try below script and check if it gives hh:mm:ss?

var milliseconds = 1536914778000;

var gdt = new GlideDuration(milliseconds);

var value = gdt.getByFormat('HH:mm:ss');

Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

View solution in original post

14 REPLIES 14

Sanjay Bagri1
Tera Guru

Hi 

this is the article for finding the Milliseconds : 

Community Code Snippet: Server-Side Millisecond Time Logging

 

Kvark
Giga Expert

find_real_file.png

Vichitra Garg
Mega Expert

Hi Kvark,

 

I tried above script. It is returning the total of the time in miliseconds in the current time. But I want the time in the format presented by you in the preview screen

change filter to sss:

\{{data.mydate | date:'yyyy-MM-dd HH:mm:ss:sss Z'\}}

p.s. added \ or it will not show {

Hi,

Can you try below script and check if it gives hh:mm:ss?

var milliseconds = 1536914778000;

var gdt = new GlideDuration(milliseconds);

var value = gdt.getByFormat('HH:mm:ss');

Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur