- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 07:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2022 10:30 PM
Hi,
907200 is seconds and it comes to 10.5 days.
Please verify it from your side what does that schedule contains, holidays etc
8 to 5 means 9 hours -> and it doesn't mean 1 day
1 day -> 24 hours
Also check the docs
Using DurationCalculator to calculate a due date
DurationCalculator calcScheduleDuration Mystery
If you take the start date as 15th June, 2022 and End Date as 23rd July, 2022
1) it comes to 28 working days excluding weekends; I am not sure if there are holidays in your schedule, I checked 8 -5 excluding holidays in my instance and there is no US holiday in it
2) so it comes to 28(days)*9(hours per day) = 252 hours
3) and 9hrs = 1 business day
4) so it comes to 252/9 = 10.5 business days
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2022 10:30 PM
Hi,
907200 is seconds and it comes to 10.5 days.
Please verify it from your side what does that schedule contains, holidays etc
8 to 5 means 9 hours -> and it doesn't mean 1 day
1 day -> 24 hours
Also check the docs
Using DurationCalculator to calculate a due date
DurationCalculator calcScheduleDuration Mystery
If you take the start date as 15th June, 2022 and End Date as 23rd July, 2022
1) it comes to 28 working days excluding weekends; I am not sure if there are holidays in your schedule, I checked 8 -5 excluding holidays in my instance and there is no US holiday in it
2) so it comes to 28(days)*9(hours per day) = 252 hours
3) and 9hrs = 1 business day
4) so it comes to 252/9 = 10.5 business days
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 03:15 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 09:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 01:59 AM
Hi Ankur, Just need one more guidance,
As now I am getting the difference into seconds, I am converting to days, so it is coming up like 9 days, 10 days, etc
But I want the difference to be displayed in duration kind of type
5 days 7 hours 20 minutes
Can you please help me how can I get this?
var start = new GlideDateTime(current.date1); //approved time
var end = new GlideDateTime(current.date2); //closed time
var dur = GlideDateTime.subtract(end, start);
var duration = new GlideDuration(dur).getDurationValue();
It is giving duration as 1969-12-31 23:58:17 when I kept logs in it.
I need to definitely use a schedule in my requirement, how can I also calculate the difference in 2 date time fields and also place in a duration field. Kindly guide me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 06:22 AM
Hi Priyanka,
Did you accidentally marked other response as correct?
Your original question was about business days for which I considered excluding weekends.
Also my earlier post gave a correct and detailed explanation why the difference is 10.5 days.
Would you mind marking appropriate response as correct.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader