0

I have this code.

This cron message means "do this method every Sunday in 01.00 a.m." or I make a mistake translating this?

@Scheduled(cron = "0 1 0 * * ?")
private void notificationsScheduler() {
    //implementation
}
Sandeep Kumar
  • 2,397
  • 5
  • 30
  • 37
Vytsalo
  • 670
  • 3
  • 9
  • 19

2 Answers2

2

you are wrong, it means every day.

suxiaohei
  • 21
  • 3
  • 1
    like: 2019-12-24 00:01:00 2019-12-25 00:01:00 2019-12-26 00:01:00 2019-12-27 00:01:00 2019-12-28 00:01:00 2019-12-29 00:01:00 – suxiaohei Dec 23 '19 at 07:00
1

Your expression

"0 1 0 * * ?" 

means: At 00:01:00am every day

As per your requirement : At 01:00:00am, on every Sunday, every month

Use:

0 0 1 ? * SUN *

Follow this https://www.freeformatter.com/cron-expression-generator-quartz.html for more detail.

Sudip Bolakhe
  • 513
  • 5
  • 16