- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2014 01:27 PM
When importing expirydate from LDAP to sys_user table - I am obtaining an incorrect date. If user expiry date in Active directory is 31/12/2014 the date being displayed on the user form on ServiceNow is 01/01/2015 I was told that It is being imported on GMT and I need to convert it to EST. Can I do it directly on the date field?
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2014 06:24 AM
It will only affect that one particular variable and field. Your script is not quite right though as you need to modify the timezone for your gDate variable. You need to put:
//converting GMT to Canada/Eastern
var tz = Packages.java.util.TimeZone.getTimeZone("Canada/Eastern");
gDate.setTZ(tz);
...right after you initialize the variable and before you assign the date to it. You should end up with:
var gDate = Packages.com.glide.glideobject.GlideDateTime();
//converting GMT to Canada/Eastern
var tz = Packages.java.util.TimeZone.getTimeZone("Canada/Eastern");
gDate.setTZ(tz);
gDate.setValue(msDate);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2014 02:10 PM
Check out this wiki article section - Using Time Zones - ServiceNow Wiki
If that does not work, try setting the timezone of the GlideDateTime object before setting the date:
var tz = Packages.java.util.TimeZone.getTimeZone("Canada/Eastern");
var gdt = new GlideDateTime();
gdt.setTZ(tz);
That should do it, I believe. I know that Packages calls are "illegal" now, but there does not seem to be a new GlideScriptable object to replace it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2014 09:04 PM
Jim, thanks for the wiki link,I tried it out but It didn't work. What do you mean by setting the timezone of the glideDateTime? where is it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2017 09:29 AM
Hi Jim,
Can you please help me here:
When i execute gs.log(gs.daysAgoEnd(2)); from back ground script, i see the result as 2017-12-04 23:59:59
But when i execute gs.log(gs.daysAgoEnd(2)); from schedule job, i see the result as 2017-12-05 06:59:59
In docs.service-now.com, it says GMT. My instance & Profile is in Canada Mountain time, How do i get end of day as 23:59:59 to run int in schedule job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2014 03:01 AM
Use source script in the transform map:
var tz = Packages.java.util.TimeZone.getTimeZone("America/Chicago");
var gdt = new GlideDateTime();
gdt.setTZ(tz);
target.date= gdt.getDisplayValue();