Monday, July 30, 2018

Convert the timezone to GMT timezone in ServiceNow

// start and end dates are in the client's timezone
var start = current.u_change_start_date.getGlideObject().getNumericValue();
var end = current.u_change_end_date.getGlideObject().getNumericValue();

var gdt = new GlideDateTime(gs.nowDateTime());
var timeZoneOffSet = gdt.getTZOffset();


// start and end times are in the current timezone
// current date time is in the GMT timezone
// converting start and end times to GMT timezone

start += timeZoneOffSet;
end += timeZoneOffSet;

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.