How to find the difference between current date and due date in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 03:30 AM
Hi All,
I have to find the difference between current date and due date in Issue Management module. Based on the due date i have to update the status in issue management. I need to get the due date in Days. Based on the days i have to update the status. Please help me. Here it is my code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 03:34 AM
Check this Arun, similar question is answered here.
Solved: Calculate the amount of days between two dates - ServiceNow Community
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 03:40 AM
you can update your code for date difference logic as
if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
CB
var now = new GlideDateTime();
var xyz = new GlideDateTime(current.due_date);
// xyz = abc.getValue("due_date");
//In Millisec
var dte = GlideDateTime.subtract(now,xyz).getNumericValue();
//in days
var dtdays=dte/(1000*6060*24);