How to convert Duration to Seconds ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2018 06:38 AM
Hi All,
I am planning to compare two fields, one fields has seconds and other field has days hours minutes and seconds. so i want compare two fields i need to convert second field to seconds. Please suggest me .
1.resolve time first field
2,Actual elapsed time is second field
Regards,
Gari
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2018 06:57 AM
Hi,
All we need to do is to convert the field into seconds. We can do this in two ways:
1. By giving the max_unit attribute. The max_unit dictionary attribute defines the maximum unit of time used in a duration. To set the maximum unit of duration measurement add the following dictionary attribute to the duration field: max_unit=seconds.
2. By providing the given line in your script it will return output of duration field to a numeric value which will be in milliseconds then divide it by .01.
var seconds = (current.my_date_field.getGlideObject().getNumericValue()/.001);
Thanks.