- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2019 07:12 AM
Hello,
I am getting value of date/time field in GMT format from one API and inserting that value to my table. I need to convert that GMT format into IST then I want to insert that value in my table.
Can anyone please help me with this.
Regards,
Nivedita
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2019 04:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2019 03:55 AM
Hello,
Can anyone please help me with this.
Regards,
Nivedita

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2019 04:12 AM
Hi Nivedita,
Try this code. This will set the event end date into IST timezone.
var gdt = new GlideDateTime();
var tz = Packages.java.util.TimeZone.getTimeZone("IST"); //sets to IST
gdt.setTZ(tz);
var Event_end_date = obj.plannedEvents[i].plannedEventEndDate;
gdt.setValue(Event_end_date);
gr.u_plannedevent_end_date =gdt.getDisplayValue();
Mark the comment as a correct answer and also helpful once worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2019 04:31 AM
Hello Asifnoor,
Thank you for your reply.
Below is my code :
for(var i = 0; i<obj.plannedEvents.length; i++) {
var gr = new GlideRecord('u_tcl_plannedevents');
gr.addQuery('u_ticket_id', obj.plannedEvents[i].ticketId);
gr.query();
if (!gr.next()) {
gs.log("insert records");
gr.initialize();
gr.u_rollback_plan = obj.plannedEvents[i].rollbackPlan;
gr.u_plannedevent_start_date = obj.plannedEvents[i].plannedEventStartDate;
gr.u_closure_code = obj.plannedEvents[i].closureCode;
gr.u_description = obj.plannedEvents[i].description;
var gdt = new GlideDateTime();
var tz = Packages.java.util.TimeZone.getTimeZone("IST"); //sets to IST
gdt.setTZ(tz);
var Event_end_date = obj.plannedEvents[i].plannedEventEndDate;
gdt.setValue(Event_end_date);
gr.u_plannedevent_end_date =gdt.getDisplayValue();
//gr.u_plannedevent_end_date = obj.plannedEvents[i].plannedEventEndDate;
gr.u_ticket_id = obj.plannedEvents[i].ticketId;
gr.u_correlation_id = obj.plannedEvents[i].correlationId;
Please correct me if i am wrong.
Regards,
Nivedita

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2019 04:45 AM
The snippet looks fine. Try updating thie line
gdt.setValue(Event_end_date);
to
gdt.setValue(new GlideDateTime(Event_end_date));
and let me know if you are facing any issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2019 05:28 AM
Hi Nivedita,
Mark the comment as a correct answer and helpful if this has worked.