GlideSchedule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2016 05:44 AM
I want to know how to use
GlideSchedule
The problem here is timezone (how to specify or load for a specific schedule)
var schedule = new GlideSchedule('090eecae0a0a0b260077e1dfa71da828', 'US/Pacific');
and
var startDate = new GlideDateTime('2014-10-25 08:00:00');
var glideSchedule = new GlideSchedule('08fcd0830a0a0b2600079f56b1adb9ae', 'UTC');
gs.info(glideSchedule.whenNext(startDate));
- Labels:
-
Scoped App Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2016 10:54 PM
Hi Midhun,
Consider this scenario:
You have to determine for a particular schedule, how much time is left for the next schedule for different time zones from a given start date.
So in this case, you would have to change the timezone for a schedule and then check the duration:
var schedule = new GlideSchedule('08fcd0830a0a0b2600079f56b1adb9ae');
schedule.setTimeZone('US/Pacific');
var startDate = new GlideDateTime('2014-10-25 08:00:00');
gs.print("Next start date according to time zone - "+schedule.getTimeZone()+" - would be after :: "+schedule.whenNext(startDate));
schedule.setTimeZone('UTC');
gs.print("Next start date according to time zone : - "+schedule.getTimeZone()+" - would be after :: "+schedule.whenNext(startDate));
Result:
*** Script: Next start date according to time zone - US/Pacific - would be after :: 198000000
*** Script: Next start date according to time zone : - UTC - would be after :: 172800000
Note: There may be a different way of implementing this scenario. I have just used it to explain the method setTimeZone().
Thanks,
Shivangi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2016 02:26 AM