- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 10:05 AM
Hi Community.
How to display the date and time of a different region in an email script if my ServiceNow server is set to the default U.S. timezone.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 10:28 AM
You can pass current.variables.hora_check_inn (assuming it's a date/time value) into the script I provided
var dateVal = new GlideDateTime(current.variables.hora_check_inn);
var pacificTime = new ScheduleDateTime(dateVal).convertTimeZone(gs.getSysTimeZone(), 'US/Pacific');
gs.info(pacificTime)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 10:14 AM
Hi Mario,
Try the below.
var now = new GlideDateTime();
var pacificTime = new GlideScheduleDateTime(now).convertTimeZone(gs.getSysTimeZone(), 'US/Pacific');
gs.info(pacificTime)
Alternatively, you can use the provided script include 'ScheduleDateTime' which does the same as the above.
var now = new GlideDateTime();
var pacificTime = new ScheduleDateTime(now).convertTimeZone(gs.getSysTimeZone(), 'US/Pacific');
gs.info(pacificTime)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 10:20 AM
I am returning the variable that contains the date and time using the following code: template.print('<label><b>' + current.variables.hora_check_inn.getDisplayValue() + '</b></label>');. The last thing I tried was applying getDisplayValue().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 10:28 AM
You can pass current.variables.hora_check_inn (assuming it's a date/time value) into the script I provided
var dateVal = new GlideDateTime(current.variables.hora_check_inn);
var pacificTime = new ScheduleDateTime(dateVal).convertTimeZone(gs.getSysTimeZone(), 'US/Pacific');
gs.info(pacificTime)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 11:33 AM
It worked very well.
