one hour time difference in getdisplayvalue and getvalue

Shahebaz2
Kilo Contributor

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.

7 REPLIES 7

Anurag Tripathi
Mega Patron
Mega Patron

I think the difference is CET and GMT or GMT and UTC

When you use getDisplayValue you get the time in the user's time zone, without it you get it in the system time(usually gmt)

-Anurag

I am not sure about GMT or UTC but my concern here is, both times are in the same timezone then why such a difference in calculation.

Same timezones mean, getValue gives in UTC and getdisplayvalue gives according to logged-in users timezone.

Harsh Vardhan
Giga Patron

I have used the getDisplayValueInternal method but it's now working. it's showing a zero(0) time difference.