How to get difference between two date/time stamp in number of days and excluding saturday sundays ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2015 08:41 PM
Hi All,
Could anyone please help me in finding difference between 2 timestamps in no. of days, and that too excluding saturdays and sundays.
Any leads would be highly appreciated.
Thanks,
Gaurav Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2015 12:38 AM
Hi Gaurav..did you find a way to get the difference as number of days. I also have a similar requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2015 04:27 AM
Use following function to get number of days excluding weekends.
function getDateDifferenceExcWeekends(start , end){
//Make Sure that start and end are GlideDateTime Objects
var days = 0 ;
while (start < end) {
start.addDays(1);
if (start.getDayOfWeek() != 6 && start.getDayOfWeek() != 7) //excluding Weekends
{
days++ ;
}
}
return days;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2016 06:28 AM
Hi Gurpreet,
I have following requirement
Set 'resolved' incident that have not been updated in the past five days to 'closed' status.
While updating records I want exclude Saturday and Sunday.