Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shakee93's avatar

Laravel Cron run weekly() starts from a date

is there any workaround i can get the cron job to run weekly from a date starting at ? for example trigger the cron after 7 days from specific date. is there any workaround for this ?

0 likes
1 reply
ciscofan's avatar

Because cron itself doesn't work with "year", you can't check actual date with cron (same for laravel cron).

But, you can try workaround it by checking the date before scheduling. Like so:

if (new DateTime() > new DateTime("2017-01-01 01:00:00")) {
      $schedule->command('foo')->weekly()->mondays()->at('13:00');
}

Please or to participate in this conversation.