Background script timezone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 02:21 PM
Has there been any changes in the way timezones are handled in background scripts? Earlier i can run with my timezone (EST), but now when i try the times are being queried in UTC format.
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 02:23 PM
Hi Karthik,
Can you share your script with us?
Also, what release of ServiceNow are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 09:10 AM
Hi Chuck, Below is the script i ran, pretty basic. the version is Eureka
var goodfriday = new GlideRecord(<tablename>);
goodfriday.addQuery ('sys_created_on','>=','2016-07-22 16:00:00');
goodfriday.addQuery ('sys_created_on','<=','2016-07-22 18:00:00');
goodfriday.addQuery ('sys_created_by','web.service');
goodfriday.query();
var count = 1;
while(goodfriday.next())
{
count = count+1;
//gs.print(goodfriday.short_description);
//gs.print(goodfriday.number);
gs.print(goodfriday.sys_created_on);
}
- gs.print(count);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 09:11 AM
use gs.print(goodfriday.sys_created_on.getDisplayValue());

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 02:26 PM
It depends, when you use getValue() you get in UTC and getDisplayValue() will get you in the user time zone