Laravel scheduler timezone

Petah picture Petah · Jan 14, 2016 · Viewed 9.1k times · Source

How do I set the Laravel scheduler to run a task at a specific time in a certain timezone? The server is set to UTC, but I want to run the task at 12 noon every Monday in the Pacific/Auckland timezone.

E.g. this will work, but the timezone is UTC:

protected function schedule(Schedule $schedule) {
    $schedule->command('run-report')->weekly()->mondays()->at('12:00'));
}

Answer

jedrzej.kurylo picture jedrzej.kurylo · Jan 15, 2016

You can do it using timezone() method:

$schedule->command('run-report')->weekly()->mondays()->at('12:00')->timezone('Pacific/Auckland');