Difference between two dates are showing in the Negative and in the form of Seconds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 04:10 AM
Hi All,
While we are calculating the difference betrween two date Field values. I ts showing the difference in the form of seconds and negative values are generating at the time of report generation. In the list level, Its showing as
Whereas in report level the difference shows like
-86817
Can anyone help me to resolve this.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 04:40 AM
can you share what script are you using for calculating?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 05:20 AM
var start = new GlideDateTime();
var end = new GlideDateTime(current.end_date);
var dur = new GlideDuration();
dur = GlideDateTime.subtract(start, end).toString();
current.setValue('u_diff', dur);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 08:27 AM
script looks good.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 10:30 AM
Hi @Ankur Bawiskar ,
In the reports its shows duration in seconds and that too its a negative value. How can we convert that seconds to minutes or days in the report level.