BackendBench
Coffee

Home โ€บ Cron errors โ€บ Quartz

Quartz ยท error

Quartz error: illegal characters for this position

java.text.ParseException: Illegal characters for this position: '?'

Why this happens

A symbol was used in a field that does not allow it. The ? is only valid in day-of-month and day-of-week, and L, W and # have their own restrictions.

Wrong and right

wrong
0 0 ? * * ?

Our parser says: ? is only allowed in day-of-month and day-of-week, not in hour

fixed
0 0 12 * * ?

At 12:00 UTC. First runs after 1 Jan 2027 (UTC): Fri 01 Jan, 12:00, Sat 02 Jan, 12:00, Sun 03 Jan, 12:00, Mon 04 Jan, 12:00, Tue 05 Jan, 12:00

How to fix it

  1. Check which field the error points at.
  2. Replace the symbol with a number, a range or *.
  3. Keep ?, L, W and # to the day fields.

The Quartz format at a glance

Fields in order: second (0-59), minute (0-59), hour (0-23), day-of-month (1-31), month (1-12), day-of-week (1-7, 1 = Sunday), year (1970-2199, optional).

Quartz uses the JVM default time zone unless you set one: CronScheduleBuilder.cronSchedule(expr).inTimeZone(TimeZone.getTimeZone("UTC")).

The fixed schedule in other systems

If you are moving this schedule to another scheduler, these are the equivalents of 0 0 12 * * ?:

SystemExpression
Spring0 0 12 * * *
Crontab0 12 * * *
Kubernetes0 12 * * *
AWS EventBridge0 12 * * ? *
Jenkins0 12 * * *
GitHub Actions0 12 * * *
node-cron0 12 * * *
Apache Airflow0 12 * * *
Azure Functions0 0 12 * * *
Google Cloud Scheduler0 12 * * *

Try it yourself

The tester below starts with the fixed expression. Change it and watch the schedule update.

Your week at a glance
fewer more runs

Upcoming runs

#LocalUTCFrom now

Copy-ready code

Frequently asked questions

Which symbols work in which field?

? L W # belong only in the day fields. Seconds, minutes, hours and months take numbers, ranges, lists, * and /.

More Quartz fixes

See the full Quartz cron builder or convert between formats.

More tools you might need