ZonoTools
Home/Developer/Cron Format Converter

Cron Format Converter

Convert between classic 5-field Unix cron and 6-field Quartz / Spring style (seconds first; uses ? when day-of-month and day-of-week conflict).

Quartz (6 fields)

0 0 9 ? * 1-5

How to use

  1. Paste your cron expression and select the source and target formats (Unix, Quartz, or Spring).
  2. Review the converted expression, paying attention to the added or removed seconds field.
  3. Verify special characters like ?, L, and #, which exist in Quartz/Spring but not standard Unix cron.

FAQ

What is the difference between Unix and Quartz cron?

Unix cron uses 5 fields (minute to weekday). Quartz uses 6 or 7 fields, adding a leading seconds field and an optional trailing year, plus extra characters like ?, L, W, and #.

Why does Spring cron have 6 fields?

Spring's scheduler expects a seconds field first, so a Spring expression has 6 fields: second, minute, hour, day of month, month, and day of week.

Can every expression convert cleanly?

Most can, but Quartz/Spring-only features such as L (last) or # (nth weekday) have no Unix equivalent and need manual review.

Introduction

A cron format converter bridges the differences between Unix cron, Quartz (Java), and Spring schedulers. Copying an expression from a Linux crontab straight into a Quartz job is a classic mistake — the field counts differ, and a missing seconds field shifts everything.

Field counts by format

Format Fields Order
Unix 5 minute, hour, day, month, weekday
Spring 6 second, minute, hour, day, month, weekday
Quartz 6–7 second, minute, hour, day, month, weekday, (year)

So Unix 0 9 * * 1-5 becomes Spring 0 0 9 * * 1-5 (a 0 seconds field is prepended).

Special characters to watch

Character Meaning Supported in
? No specific value Quartz, Spring
L Last day/weekday Quartz, Spring
W Nearest weekday Quartz
# Nth weekday of month Quartz, Spring

Standard Unix cron does not understand these, so converting them down to Unix requires a manual workaround.

Common Use Cases

  • Porting a Linux crontab schedule into a Spring @Scheduled annotation.
  • Migrating Quartz jobs to a Unix-based scheduler or container CronJob.
  • Reconciling schedules across a polyglot stack.

Best Practices

  • Always double-check the seconds field after converting to or from Unix.
  • Flag any L, W, or # usage for manual review — there is no clean Unix equivalent.
  • Validate the result with the cron expression validator and confirm timing with the cron next run calculator.