I was using Simple
schedulers and I had a problem that for example I had a job which was executing once in a day at 13:00 , but when daylight saving was emerging it was executed at 14:00, but I wanted it to be executed exactly at 13:00. I researched and saw that I could set timezone
to cronScheduler
and it should solve the problem, then I modified code and now I have
trigger = (CronTrigger) TriggerBuilder.newTrigger()
.withIdentity(key, group)
.startAt(startTime)
.withSchedule(schedBuilder.withMisfireHandlingInstructionFireAndProceed()
.inTimeZone(TimeZone.getTimeZone(timeZone)))
.forJob(jobDetail.getKey().getName(), jobDetail.getKey().getGroup())
.build();
where I am setting timezone for example Europe/Berlin
and CronExpression
something like this 0 0 13 * * ? *
but when time changes due to daylight saving I am getting same behavior and trigger is exeuted at 14:00:00 instead of 13:00:00. Am I still missing something or what is the issue?
What is the possible solution to fix this issue ?
If this timezone of CronTrigger
does not have any effect, what is the reason to have(set) it ?
I was expected something like this if I set Europe/Berlin
timezone and 0 0 13 * * ? *
expression it should be run exactly at 13:00:00 for Berlin time and same for any other timezones.