Hello there,
I'm currently using v8.1.24 and I want to reach out exist next shift variables.
I'm getting the current shift variables with that script;
import system
import datetime
import java.util.Date
import java.util.Calendar
def ScheduleActive(dtValue, schedule):
# Retur True if scheduler (scheduleName) is active at given time point (dtValue)
# dtValue ... time point that is checked (datetime)
# schedule ... schedule that is checked (BasicSchedule)
cal = java.util.Calendar.getInstance()
cal.setTime(dtValue);
# schedule = system.user.getSchedule(scheduleName)
if schedule.observeHolidays:
holidays = system.user.getHolidays()
for holiday in holidays:
if system.date.midnight(holiday.getDate()) == system.date.midnight(dtValue):
return {"Active":False, "startDate": None, "endDate": None} # today is a holiday
timeline = schedule.getScheduleForDay(cal)
midnight = system.date.midnight(dtValue)
msTime = system.date.millisBetween(midnight, dtValue)
if timeline != None:
segment = timeline.getSegment(msTime, False, True)
if segment != None:
tzOffset = system.date.getTimezoneRawOffset()
startDate = system.date.fromMillis(system.date.toMillis(midnight)+segment.getStart())
endDate = system.date.fromMillis(system.date.toMillis(midnight)+segment.getEnd())
return {"Active":True, "startDate": startDate, "endDate":endDate}
else:
return {"Active":False, "startDate": None, "endDate": None}
else:
return {"Active":False, "startDate": None, "endDate": None}
How can i get next 1 hour shift variables?
Does anybody have any idea about that?
Thanks in advance.