This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Facing problem for building cron expression daily for every N days Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Facing problem for building cron expression daily for every N days" Watch "Facing problem for building cron expression daily for every N days" New topic
Author

Facing problem for building cron expression daily for every N days

Gnana Prasuna
Greenhorn

Joined: Feb 18, 2009
Posts: 14
Hi All,

I am facing problem in building cron expression for below pattern.

Daily for every three days starting on nov 09, no end date
cron expression: 0 0 0 09/3 * ? *
output is 9th,12th,15th.....

Above expression working fine before last week of month.

If i try the same expression for this paatern every three days starting on 29 nov, no end date
cron expression: 0 0 0 29/3 * ? *
output 29th nov,29th dec,29th jan, 29th mar

Can some body help me in build expreesion for handling above 2 cases.

Thanks,
Prasuna.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Every time I look at cron documentation, I see there's two kinds of day: there's Day-Of-Month and there's Day-Of-Week. You're experimenting with Day-Of-Month and now you have found how it behaves. Notice the "Of-Month" part in the description, that explains why it behaves that way.

If that isn't clear, then let me put it this way: from the cron documentation I have read, I wouldn't expect to be able to produce an expression which meant "every three days regardless of month boundaries".
 
wood burning stoves
 
subject: Facing problem for building cron expression daily for every N days
 
Similar Threads
Quartz Scheduler that runs every x months
Cron expression to run every two days from the current day
Need help with Quartz's Cron Expression
cron expression for every 45 minutes
Generating Cron Expression