I am trying to create a scheduler to run in EST timezone. For that, I have added @Scheduled annotation upon the scheduled method. The method is given below. I want this method to run daily at 05:00 am EST on Mon-Friday, but it runs at 3:30 am IST (6:00 pm EST).
@Scheduled(cron = "0 0 5 * * MON-FRI", zone = "EST")
public void jobRunDaily() {
logger.info("jobRunDaily : called");
this.sendEmailDaily();
}
As described in the documentation, zone
accepts IDs that are valid for TimeZone.getTimeZone(String)
.
In TimeZone
documentation you will find the following for such method:
the ID for a TimeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations is for JDK 1.1.x compatibility only and full names should be used.
Meaning that full names should be used instead of your "EST" abbreviation.