日历或日期到Cron表达

时间:2012-12-10 14:01:05

标签: java date calendar cron cronexpression

  

可能重复:
  Is there a java class for constructing a cron expression using a date?

有没有比使用字符串连接更好的方法将Calendar或Date转换为cron表达式? 等;

Calendar now = Calendar.getInstance();    
String cronExpression = now.get(Calendar.SECOND) + " " + now.get(Calendar.MINUTE) + " " + now.get(Calendar.HOUR_OF_DAY) + " " + now.get(Calendar.DAY_OF_MONTH) + " " + now.get(Calendar.MONTH) + " ? " + now.get(Calendar.YEAR);

0 个答案:

没有答案