Convert Duration into minute

coolsaurabh
Tera Contributor

I have a field on incident table of duration type which contains days hours and minute . Is it possible to convert into minute and auto populate into another field.

Thanks,

Sourabh

6 REPLIES 6

nayanawadhiya1
Kilo Sage

Hey Sourabh,



You can do it like that -



var minutes = current.duration / 1000 /60;


current.fieldToStoreMinutes = minutes ;


Hi Nayan,



I have a Duration type field. Which contains value in days,hour , minutes and seconds.


I want to capture this value into another field of type string in minutes.



I am looking for client script for this.



I tried above solution but didn't get success.



Thanks,


Sourabh


Hello Sourabh,



Split the Duration field values and store into array then convert it into minutes.



var day = current.duration_field.split(' ');


var dayintomin = day[0] * 24*60;


var hrs = day[1].split(':');


var hrsintomin = hrs[0] * 60;


var mins = hrs[1] + hrs[2]/60;


var totalmins = dayintomin + hrsintomin + mins;


Hello Sourabh,



Mark ANSWER as correct if my answer fulfill your requirement.


How To Mark Answers Correct From Community Inbox