0

I am trying to execute job daily at certain time, but it is always executed 2 hours later.
The job just writes a log.

If I use this scheduler:

$schedule->job(new MyJob)->dailyAt('10:00');

The log is always written at 12:00AM.

I have a vps with debian, and the result of the date command on the server is right.
I tried to change the file /etc/adjtime from UTC to LOCAL without success.

Giacomo M
  • 4,450
  • 7
  • 28
  • 57
  • In config/app.php is a setting `'timezone' => 'UTC',` so i would assume the system timezone does not affect anything in laravel. You could specify a timezone when scheduling the job like `$schedule->job(new MyJob)->dailyAt('10:00')->timezone('America/Chicago');` – Roland Starke Sep 23 '20 at 10:45
  • @RolandStarke I changed the value in config/app.php and it worked, even if in the log I write the php date and it writes 2 hours before. Is it normal? – Giacomo M Sep 23 '20 at 10:56
  • Hey, sorry, i am a very superficial programmer and have actually no clue about anything. I would not think that its normal when logging with date('Y-m-d H:i:s ') or DateTime or Carbon. I would assume it shows 10:00. When changing in app.php – Roland Starke Sep 23 '20 at 11:11

1 Answers1

0

Thanks to the Roland Starke comment I solved changing the value in config/app.php:

From:

'timezone' => 'UTC',

To:

 'timezone' => 'my timezone',
Giacomo M
  • 4,450
  • 7
  • 28
  • 57