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

Sven2157's avatar

Schedule/Cron Jobs 6th Parameter

Can anyone tell me what the 6th parameter is used for, in the time expression?

Example: Illuminate\Console\Scheduling\Event

public function hourly()
{
    $this->expression = '0 * * * * *';

    return $this;
}

It is my understanding that cron only take 5 time parameters.

0 likes
4 replies
jasonfrye's avatar
Level 9

I believe that's processed by the CronExpression class which has six constants: minute, hour, day, month, weekday, year. Cron uses minute, hour, day, month, weekday. The addition of the year for the yearly() method seems to be the reason for the extra *.

mul14's avatar

Based on Cron Expression documentation https://github.com/mtdowling/cron-expression , the sixth parameter is optional year.

*    *    *    *    *    *
-    -    -    -    -    -
|    |    |    |    |    |
|    |    |    |    |    + year [optional]
|    |    |    |    +----- day of week (0 - 7) (Sunday=0 or 7)
|    |    |    +---------- month (1 - 12)
|    |    +--------------- day of month (1 - 31)
|    +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)
1 like
Sven2157's avatar

Ok, what threw me off, was the ability to run an annual task with the following:

0 0 1 1 *

So, this then allows to run a task every 5 or 10 years? Though, I can't see how that would be applicable.

mul14's avatar

This cron will run at 2015, 2020 and 2025

0 0 1 1 0 2015,2020,2025

To make it runs every 5 years

0 0 1 1 0 */5

Please or to participate in this conversation.