CronTool
Cron expression editor & debugger

dragonmantank/cron-expression — last day of the month (PHP)

dragonmantank/cron-expression — the PHP cron parser behind Laravel scheduling, Symfony Scheduler and most modern PHP schedulers — supports the L modifier in the day-of-month field. 0 0 L * * fires at midnight on the last day of every month.
See the full guide on dragonmantank/cron-expression syntax for the field-by-field reference, or the cross-library last-day-of-month guide for the equivalent in other schedulers.

Examples

  • 018***
    Every day at 18:00
  • 0*/5***
    Every 5 hours
  • 018**1-5
    Weekdays at 18:00
  • 001**
    Once a month

Cheatsheet

FieldRequiredValues RangeWildcardsminuteYes0-59, - * / hourYes0-59, - * / day of monthYes1-31, - * / L W monthYes1-12, - * /day of weekYes0-7, - * / L

Calendar

View future cron matches in a calendar

April 2026

Showing next 1000 cron schedules

Loading...

Direct library usage

<?php

require 'vendor/autoload.php';

use Cron\CronExpression;

$cron = new CronExpression('0 0 L * *');

// When does it fire next?
$next = $cron->getNextRunDate();
echo $next->format('Y-m-d H:i'); // e.g. "2026-04-30 00:00"

// Is the schedule due right now?
if ($cron->isDue()) {
    runMonthEndJob();
}

// Multi-step preview
foreach ($cron->getMultipleRunDates(5) as $date) {
    echo $date->format('Y-m-d H:i') . "\n";
}

Laravel scheduling example

<?php
// app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
    // Using the named helper (Laravel 8+)
    $schedule->command('billing:close-month')
             ->lastDayOfMonth();   // → equivalent to ->cron('0 0 L * *')

    // Or with an explicit cron expression
    $schedule->command('reports:monthly')
             ->cron('0 1 L * *')   // 01:00 on the last day of every month
             ->onFailure(function () {
                 // alerting hook
             });
}

Laravel's scheduler runs every minute (via a single system cron entry on the server) and dispatches the matching schedule entries. The last-day-of-month job will be picked up correctly because the underlying parser supports L.

Symfony Scheduler example

<?php

use Symfony\Component\Scheduler\Attribute\AsSchedule;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\ScheduleProviderInterface;
use Symfony\Component\Scheduler\Trigger\CronExpressionTrigger;

#[AsSchedule('billing')]
final class BillingSchedule implements ScheduleProviderInterface
{
    public function getSchedule(): Schedule
    {
        return (new Schedule())->add(
            CronExpressionTrigger::fromSpec('0 0 L * *')->message(
                new CloseMonthMessage(),
            ),
        );
    }
}

PHP-specific pitfalls

  • Server timezone — `getNextRunDate()` uses the PHP default timezone (set via `date_default_timezone_set` or `php.ini`). For UTC consistency, pin it explicitly: new DateTimeZone('UTC').
  • Laravel scheduler precision — the scheduler runs every minute. A last-day-of-month job at 00:00 fires somewhere in the 00:00:00-00:00:59 window, not precisely at the second.
  • `isDue()` vs `getNextRunDate()` isDue() tests against the current minute; getNextRunDate() looks forward. Don't mix them when testing at the boundary of a minute.
  • L vs LW — both supported. LW gives last weekday; useful when month-end falls on a weekend and you want the latest business day instead.

Frequently asked questions

Does dragonmantank/cron-expression support the L modifier?

Yes. `dragonmantank/cron-expression` (the most popular PHP cron parser, used by Laravel, Symfony scheduler and many others) supports the `L` modifier in the day-of-month field. Use `0 0 L * *` for midnight on the last day of every month. The library also supports `?`, `W` and `#` in compatible positions.

How do I use last-day-of-month in Laravel scheduling?

Laravel's task scheduler wraps `dragonmantank/cron-expression`. Use `->cron('0 0 L * *')` in your `app/Console/Kernel.php` schedule method. Or use the named helper: `->lastDayOfMonth()` (added in Laravel 8.x), which is equivalent to `->cron('0 0 L * *')`.

How do I use last-day-of-month in Symfony Scheduler?

Symfony Scheduler 6.3+ accepts cron expressions via the `CronExpressionTrigger`. Construct it with `'0 0 L * *'` and the trigger fires at midnight on the last day of every month. Internally it uses the same `dragonmantank/cron-expression` parser.

What PHP versions does dragonmantank/cron-expression support?

The current major version (3.x) requires PHP 8.0+. Version 2.x supports PHP 7.2+. The `L` modifier has been supported since 1.x, so you don't need a recent version specifically for last-day-of-month.

Does the library support `LW` (last weekday)?

Yes. `0 0 LW * *` fires at midnight on the last weekday of the month — Friday if the last day is Saturday, Friday if Sunday, otherwise the actual last day. Useful for monthly accounting jobs that should never run on weekends.

Ready to schedule it?

Point Crontap at any URL. Pick any cron. Done.

WordPress, Shopify, Railway, Cloud Run, Vercel, HubSpot, Ghost, your own box. If it answers HTTP, Crontap can drive it on a clock you can read, in the timezone that actually matters, and page you when something breaks.

Free forever tier ・ No credit card required

Your next schedule
GET/wp-cron.php?doing_wp_cron=1

Schedule

every 5 minutes

Next run

in 23s

Apihustle Logo

This tool is part of the Apihustle suite - a collection of tools to test, improve and get to know your API inside and out.

  • Clobbr logo

    Clobbr

    The app & CLI tool to test API endpoint speed.

    Visit
  • Crontap logo

    Crontap

    Schedule recurring API calls using cron syntax.

    Visit
  • CronTool logo

    CronTool

    Debug multiple cron expressions on a calendar.

    Visit

  • Page AI

    AI Website Generator that designs and writes clean code.

    Visit
  • Shipixen

    Generate customized boilerplates in minutes.

    Visit
  • Page UI

    Landing page UI components for React & Next.js

    Visit