Class CronUtil

java.lang.Object
com.luna.common.cron.CronUtil

public class CronUtil extends Object
  • Constructor Details

    • CronUtil

      public CronUtil()
  • Method Details

    • getCronAfterMinutes

      public static String getCronAfterMinutes(int minute)
      相对于当前时间多少分钟后的执行任务的cron表达式
      Parameters:
      minute -
      Returns:
    • getCronAfterSeconds

      public static String getCronAfterSeconds(int second)
    • getCron

      public static String getCron(Date date)
      convert Date to cron ,eg. "0 06 10 15 1 ? 2014"
      Parameters:
      date - : 时间点
      Returns:
    • getCronEveryXMinutes

      public static String getCronEveryXMinutes(int x)
      周期性任务,每X分钟执行一次
      Parameters:
      x -
      Returns:
    • formatDateByCron

      public static Date formatDateByCron(String cron, long time)
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception
    • checkCronOneTime

      public static boolean checkCronOneTime(String cron) throws RuntimeException
      Throws:
      RuntimeException