Skip to content
ToolShedby Wasim Shaikh

Liferay Quartz Cron Expression Builder

Build and validate Quartz cron expressions for Liferay scheduled jobs. See the schedule in plain English and the next 10 runs in your server's time zone, then copy it into the Job Scheduler or a ready-made Java snippet.

Liferay Cron Expression Builder

Build and validate Quartz cron expressions for Liferay jobs: plain-English schedule, next 10 runs in any time zone, L/W/# and Unix conversion.

At 09:00, Monday through Friday.

Fields

0-59 , - * /

0-59 , - * /

0-23 , - * /

1-31 , - * / ? L W

1-12 JAN-DEC , - * /

1-7 SUN-SAT , - * / ? L #

1970-2099 , - * /

One of the two day fields must be ?. Day of week uses 1-7 with SUN = 1, so 2 is Monday. L = last, W = nearest weekday, 6#3 = third Friday.

Next 10 runs

    Liferay evaluates the expression in the JVM's time zone (-Duser.timezone) unless the job sets one. The Job Scheduler UI lets you pick a time zone per task (7.4 U35+).

    Use it in Liferay

    1. Open Control Panel → Configuration → Job Scheduler (called Dispatch in earlier 7.4 updates).
    2. Add a task, or open an existing one, and open its trigger settings.
    3. Paste 0 0 9 ? * MON-FRI into Cron Expression, pick the time zone and cluster mode, then switch Active on.

    Quartz Cron in Liferay

    Liferay's scheduler is built on Quartz, so its cron expressions follow Quartz's CronTrigger rules rather than Unix crontab. The format is second minute hour day-of-month month day-of-week [year].

    FieldValuesSpecial characters
    Second0-59, - * /
    Minute0-59, - * /
    Hour0-23, - * /
    Day of month1-31, - * / ? L W
    Month1-12 or JAN-DEC, - * /
    Day of week1-7 or SUN-SAT (SUN = 1), - * / ? L #
    Year (optional)1970-2099, - * /

    Three rules that trip people up

    • One day field must be ?. 0 0 9 * * * is valid Spring cron but invalid Quartz; write 0 0 9 * * ?.
    • Days of the week are 1-7, starting Sunday. 1 is Sunday and 2 is Monday. Use names like MON to avoid off-by-one mistakes.
    • Seconds come first. A 5-field Unix line like 0 9 * * 1 needs a leading seconds field, and its weekday shifted, to become 0 0 9 ? * 2.

    Common Examples

    Scheduling Jobs in Liferay

    • Job Scheduler UI: Control Panel → Configuration → Job Scheduler. Each task has a cron expression, start and end dates, a time zone (7.4 U35+), an overlap setting and a cluster mode (single node or all nodes).
    • SchedulerJobConfiguration (DXP 2023.Q4+ / Portal GA93+): a component that returns the job logic and a TriggerConfiguration, either an interval or a cron expression.
    • MessageListener (Liferay 7.0 to 7.4): register a trigger from TriggerFactory with SchedulerEngineHelper in the component's activate method.

    Frequently Asked Questions

    What is the Quartz cron format?
    Liferay schedules jobs with Quartz. A Quartz cron expression has 6 or 7 space-separated fields: second, minute, hour, day-of-month, month, day-of-week and an optional year. Unlike Unix cron it starts with seconds, numbers days of the week 1-7 with Sunday = 1, and requires "?" in one of the two day fields.
    Why does Liferay reject "0 0 9 * * *"?
    Quartz does not support setting both day-of-month and day-of-week. One of them must be "?". Use "0 0 9 * * ?" for every day at 9 AM, or "0 0 9 ? * MON" for Mondays only.
    How do I schedule a job in Liferay with a cron expression?
    Without code, open Control Panel > Configuration > Job Scheduler (called Dispatch in earlier 7.4 updates), add a task and paste the expression into its Cron Expression field. In code, on DXP 2023.Q4+ implement SchedulerJobConfiguration and return TriggerConfiguration.createTriggerConfiguration("your cron"); on older 7.x versions register a MessageListener with TriggerFactory and SchedulerEngineHelper. The builder generates both snippets.
    What do L, W and # mean?
    "L" means last: L in day-of-month is the last day of the month, L-3 is three days before it, and 6L in day-of-week is the last Friday. "W" means nearest weekday: 15W fires on the weekday closest to the 15th, and LW on the last weekday. "#" picks the nth weekday: 6#3 is the third Friday of the month.
    Will my job run on every node in a cluster?
    In the Job Scheduler UI you choose the Task Execution Cluster Mode: Single Node or All Nodes. Jobs registered in code use Liferay's clustered scheduler storage by default, which fires each trigger on one node.
    Which time zone does the schedule use?
    Code-registered triggers use the JVM default time zone (set with -Duser.timezone). Job Scheduler tasks can set their own time zone from 7.4 U35+. Pick the same zone in the builder to see exactly when the job will fire.
    Can I convert a Unix crontab line?
    Yes. Paste a 5-field Unix expression and click "Convert from Unix cron". The builder adds the seconds field, shifts day-of-week numbers from 0-6 to 1-7 and inserts the required "?".

    Official Resources