- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 09:21 PM
Hi,
How do you convert duration to seconds in js.
Exporting duration to excel give the value in seconds. eg. 600
In Js, duration using obj.getDisplayvalue() gives me "10 min"
is there a obj.getseconds()? so it comes out in seconds - consistent with the excel export?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 10:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 09:47 PM
Hi Michael,
You would have to create a new custom string field and store the display value of your duration field in it and then export it to excel.
Apart from this I am really not aware of any OOB way to achieve it.
Thanks,
Kannan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 09:50 PM
var duration = obj.getNumericValue();
var durationSeconds = (duration/1000);
This should give the duration in seconds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 10:08 PM
if (x === "u_glide_duration_1")
{
var duration = myobj.getNumericValue();
var durationSeconds = (duration/1000);
jsonstring += '"duration":"' + durationSeconds/*.getDisplayValue()*/ + '",';
jsonstring += '"duration":"' + myobj.getDisplayValue() + '",';
}
jsonstring output:
"duration":"NaN","duration":"1 Minute"
I don't know why it's getting NaN. It returns 1 minute with the getdisplayvalue()
duration is nan.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 10:17 PM
Try below code:
1)myobj.getGlideObject().getNumericValue();