cronTrigger.getExpressionSummary()
例子:
CronTrigger t = new CronTrigger();
t.setCronExpression("0 30 10-13 ? * WED,FRI");
System.out.println(""+t.getExpressionSummary());
输出:
seconds: 0
minutes: 30
hours: 10,11,12,13
daysOfMonth: ?
months: *
daysOfWeek: 4,6
lastdayOfWeek: false
nearestWeekday: false
NthDayOfWeek: 0
lastdayOfMonth: false
years: *
您可能会发现cron-utils对此任务很有用,因为它提供了各种语言的人类可读描述,并且不需要完整的调度程序来提供它们。支持多个cron格式。 下面是文档中的代码片段:
//create a descriptor for a specific Locale
CronDescriptor descriptor = CronDescriptor.instance(Locale.UK);
//parse some expression and ask descriptor for description
String description = descriptor.describe(parser.parse("*/45 * * * * *"));
//description will be: "every 45 seconds"
new SchedulingPattern("0 30 10-13 ? * 1,2,5")