- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018 05:25 AM
Because the community was so helpful with my last enquiry I have another question.
We have a resolve time which was configured in seconds. I need this in hours and minutes, I've looked on the community boards but still at a loss.
This is made up of the hours between the incident opening and closing can someone help me with the script what I need to change to make hours and minutes?
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(60*60*1000);};
hours(current.opened_at, current.resolved_at);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018 08:10 AM
Hi Andrew,
you can try using this function as onLoad client script:
function getTime(seconds) {
var myDate = new Date(0,0,0,0,0,x);
var hours = '0' + myDate.getHours();
var minutes = '0' + myDate.getMinutes();
return hours.slice(-2) + ':' + minutes.slice(-2);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018 08:10 AM
Hi Andrew,
you can try using this function as onLoad client script:
function getTime(seconds) {
var myDate = new Date(0,0,0,0,0,x);
var hours = '0' + myDate.getHours();
var minutes = '0' + myDate.getMinutes();
return hours.slice(-2) + ':' + minutes.slice(-2);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018 08:38 AM
Create two new fields, one to hold 'minutes', one to hold 'hours'.
Take your value from 'seconds' and apply the appropriate math via Business Rule script to populate the other fields.
Unless I misread what your end goal is.