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

Gabotronix's avatar

Question about server date and laravel cron jobs

Hi everybody, I just learnt about cron jobs in the server and larave crons, in my laravel apps I set timezone in .env file like this:

APP_TIMEZONE='Europe/Madrid'

Now in my ubuntu VPS I ran the command

date

And noticed it says UTC with one hour earlier than my local time (one hour less sorry for english), Now I have two questions:

When I run a cron job from laravel using the schedule command what time does the app take into account to run the commands, my VPS time (UTC, one hour less) or my laravel app time (Europe/Madrid)?

I want to fix my VPS time so its the same as my local time (changing it to UTC+1 would fix it) , how can I change the date/timezone? Is it a good idea to do this?

0 likes
1 reply
khalilm's avatar

You can set the time zone in the schedule->job function if you dont want to change the VPS time. For example:

$TIMEZONE = env('TIMEZONE', 'America/Toronto'); $schedule->job(new ReminderJob)->monthlyOn(1, '03:00')->withoutOverlapping()->timezone($TIMEZONE);

Please or to participate in this conversation.