one hour time difference in getdisplayvalue and getvalue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 07:51 AM
Hello Experts,
I am experiencing very strange behavior while calculating the time difference between two dates.
I am also using the schedule to exclude weekends from time calculation.
When I fetch the values of GlideDateTime objects using getDisplayvalue and subtracting those values is one hour more than the difference between those values which are fetched by using getvalue method of glidedatetime.
For example
date1 = 2020-12-02 11:22:06 and date2 = 2020-12-21 00:00:00
time difference between two dates when values fetch using getDisplayvalue is 12Days 12:37:54(HH:MM: SS)
time difference between two dates when values fetch using getvalue is 12Days 13:37:54(HH:MM: SS)
Please suggest your valuable comment on this.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 08:02 AM
can you paste the full script ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 08:05 AM
sample code:
var start = new GlideDateTime("2016-08-28 09:00:00");
var end = new GlideDateTime("2016-08-31 08:10:00");
gs.print(gs.dateDiff(start.getDisplayValueInternal(), end.getDisplayValueInternal(), true)); // returns the number of seconds as String
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 09:25 AM
As suggested please share complete script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader