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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

14 REPLIES 14

Sanjay Bagri1
Tera Guru

Hi ,

Please can you go through these links : these might help you

getNumericValue() -   GlideDateTime - ServiceNow Wiki

setNumericValue(milliseconds)   - GlideDateTime - ServiceNow Wiki

 

Please mark as correct and helpul.

Thanks 

Sanjay Bagri

Hi Sanjay,

I have gone through these links but they were not helpful in providing the time in the required format

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Is this required on a table record form?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

I require this in my scripting part. Milisecond value is to be used in the naming convention of the attached excel file