How do we create a cronExpression using Java code -


For example if I want to convert 2011-03-27 T11: 15: 05 into a valid Cron expression How do I do that

The creation sequence of a cron expression is:

    < Li
  1. hours
  2. day of the month
  3. month
  4. day of the week < Li> Year [Optional]

    So if you look at the expression <05> 05 15 11 27 03? 11 This is called a fire on 27 March 2011 at 11:15:05.

    In Java, you can easily obtain this information from the date. So now I think that you will be bundled to make a cron expression.

    Hope it helps.

    Reference: -


    Edit: -

    Here is an example: -

      schedulerffecture sf = new stsfilerfactor (); Scheduler shade = sf.getScheduler (); Sched.start (); Job Details JD = New Job Dictate ("Miezb", Scheduler. DEFAULT_GROUP, Kroneesthler.class); Chronograph Tr = New Chronograph ("My", Scheduler. DEFAULT_GROUP, "05 15 11 27 03? 11"); Sched.scheduleJob (jd, tr);    

Comments