How to convert Duration to Seconds ?

Rushi2
Tera Expert

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 fieldfind_real_file.png

 

find_real_file.png

 

 

Regards, 

Gari

1 REPLY 1

Bhawana Upreti
Tera Guru

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.