- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 05:16 AM - edited 03-13-2024 06:10 AM
Hello Team,
I'm using the below glideschedule API to get the next window time of the maintenance schedule. As the API is providing the results in milliseconds. I'm converting the same to datetime format using the below script.
var schedule = new GlideSchedule('e7d33c2bdbf4029055ee4098139619ee');
var whenNext = schedule.whenNext();
gs.info('WN '+whenNext);
var gdt = new GlideDateTime();
gdt.setNumericValue(whenNext);
gs.info('Epo '+gdt.getDisplayValue());
I'm getting the below result. However this is not correct. Am I missing something? Please advise on the same.
*** Script: Epo 02-01-1970 20:47:13
I'm expecting the datetime result in current/future datetime.
Thanks,
DC
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:42 AM
Can you please try with below code.
var schedule = new GlideSchedule('e7d33c2bdbf4029055ee4098139619ee');
var whenNext = schedule.whenNext();
gs.info('WN '+whenNext);
var gdt = new GlideDateTime();
gdt.add(whenNext)
gs.info('Epo '+ gdt.getValue());
Please mark helpful or accept answer if provided info works for you.
Thank You.
Regards,
Shubham Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 05:28 AM
Hi @Dineshdmkk18 ,
Can you try after specifying the timezone as well in the whennext function like below :
var glideSchedule = new GlideSchedule('08fcd0830a0a0b2600079f56b1123456', 'UTC');
Also if the GlideSchedule object is within the schedule it might not return a meaningful value.
Please mark helpful/correct if my response helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:42 AM
Can you please try with below code.
var schedule = new GlideSchedule('e7d33c2bdbf4029055ee4098139619ee');
var whenNext = schedule.whenNext();
gs.info('WN '+whenNext);
var gdt = new GlideDateTime();
gdt.add(whenNext)
gs.info('Epo '+ gdt.getValue());
Please mark helpful or accept answer if provided info works for you.
Thank You.
Regards,
Shubham Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 02:57 AM
Thank you @Shubham26