Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 10:25 AM
I am trying to create a calculated value field within a form. The value should be the number of days between the current day and the due date field. "due_date" is a field within the table that I created. Right now there is nothing being displayed.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 10:52 AM
Hi @ChadLee4 ,
You can use below script
var todayDate = new GlideDateTime();
var dueDate = new GlideDateTime(current.due_date);
var diff = GlideDateTime.subtract(todayDate, dueDate);
var days = diff.getRoundedDayPart();
return days;
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 10:52 AM
Hi @ChadLee4 ,
You can use below script
var todayDate = new GlideDateTime();
var dueDate = new GlideDateTime(current.due_date);
var diff = GlideDateTime.subtract(todayDate, dueDate);
var days = diff.getRoundedDayPart();
return days;