/cron-parser

Java Parser For Cron Expressions

Primary LanguageJavaMIT LicenseMIT

cron-parser

Join the chat at https://gitter.im/grahamar/cron-parser Build Status Stories in Ready

A Java library that converts cron expressions into human readable strings. Translated to Java from https://github.com/bradyholt/cron-expression-descriptor.

Original Author & Credit: Brady Holt (http://www.geekytidbits.com) License: MIT

Features

  • Supports all cron expression special characters including * / , - ? L W, #.
  • Supports 5, 6 (w/ seconds or year), or 7 (w/ seconds and year) part cron expressions.
  • Provides casing options (Sentence, Title, Lower, etc.).
  • Support for non-standard non-zero-based week day numbers.
  • Supports printing to locale specific human readable format (Italian, English, Spanish, Romanian, Dutch, French and Chinese【中文】 so far...).

Download

cron-parser is available in the maven central repository, please select the latest version from there.

Usage Examples (Unit Tests)

See CronExpressionDescriptorTest

修改中文的CronParserI18N_zh.properties

使解析的Cron表达式符合国人使用习惯。

例:

cronExp = "0 0 2 1 * ? *";

原始解析结果为: 在上午2:00, 在当月的1日

现解析结果:每月1日上午2:00

具体可查看CronExpressionDescriptorZHTest文件。

若想使用原版,请访问原版git