Date Time field value is not setting correctly.

rahulyamgar
Tera Guru

Hello friends,

 

I am facing an issue with the setting of the data time field value i.e. First Discovered and Last Discovered fields from the the CI table. When I am trying to set value using the Field Map from transform map, it sets correctly, but to create other child CI records, when i use the GlideRecord`s setValue("first_discovered",dateTime), it does not reflect the correct time. There is a diffference of 5 hours from what I am trying to set and what is actually set.

Below is the screen shot:

Input

First Discovered:2020-03-18 00:25:00

Last Discovered : 2020-05-10 23:18:00

Output: First record is created through GlideRecord setValue (wrong one) while second created with the transform field map  correct one (correct one).  Input is same for both of them.

find_real_file.png

 

Thanks,
Rahul Y

1 ACCEPTED SOLUTION
3 REPLIES 3

Bharath40
Giga Guru

vimal11592
Tera Expert

I think by default it updates the date in GMT. We were facing the same issue when trying to update the Planned start time in change management module. It was always showing the 5 hr difference. So service now support team has confirmed it converts the date in GMT time zone.

rahulyamgar
Tera Guru

I found out the fix. I replaced the grRec.setValue("first_discovered",dateTime) to grRec.first_discovered = dateTime (of GlideDateTime). It worked.

 

I need to understand further on GlideDateTime object and how values are stored.

 

Thanks,
Rahul