Issue
My Java Web application has a Cron Job Scheduler which should trigger every hour starting from 7AM PST to 6PM PST. I am not getting how to specify PST time zone using zone parameter inside @Scheduled annotation. Kindly help
@Component
public class CronJobForFailedLoans {
@Scheduled(cron ="0 0 7-18 ? * *")
public void cronJobForFailedLoans() {
// Perform operations
} }
Solution
Your cron
expression is valid just use Zone
to specify the timezone, use online cron for validating and generating cron expression
@Scheduled(cron ="0 0 7-18 ? * *", zone="America/Los_Angeles")
Answered By - Deadpool