aspose file tools*
The moose likes Other Open Source Projects and the fly likes Quartz Cron Expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Quartz Cron Expression " Watch "Quartz Cron Expression " New topic
Author

Quartz Cron Expression

santosh joshi
Greenhorn

Joined: Aug 20, 2007
Posts: 21
I am getting problem in writing a cron Exp that triggers every monday,tuesday,wednesday and every 2nd and 4th Thrusday.

I just wrote

0 0 0 0 0 MON-WED,THU#2,THU#4 ?

But this does not work.


Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

What version of quartz are you using and what's the error message you're getting?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
santosh joshi
Greenhorn

Joined: Aug 20, 2007
Posts: 21
I am using quartz 1.5.2,

Getting no Error message, as the expression compiles successfully, outputting only monday, tuesday and wednesday,
and ignores the thrusdays's value.

seems THU#2,THU#4 creates problem
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

The Javadoc for that version seems to indicate that the # syntax only works with numerics e.g. 6#3
santosh joshi
Greenhorn

Joined: Aug 20, 2007
Posts: 21
"0 0 0 ? * 2-3,5 *"

returns

Mon Jan 17 00:00:00 IST 2011
Tue Jan 18 00:00:00 IST 2011
Thu Jan 20 00:00:00 IST 2011

"0 0 0 ? * 2-3,5#4 *"
returns

Mon Jan 24 00:00:00 IST 2011
Mon Feb 28 00:00:00 IST 2011
Mon Mar 28 00:00:00 IST 2011
Mon Apr 25 00:00:00 IST 2011

so this returns wrong result

Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Probably a quartz bug, it's up to at least 1.7.3+ now, I'd perhaps upgrade
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

This seems related to this bug. It doesn't seem to be fixed in the latest version. Maybe you should use a different trigger for every 2nd Thursday of the month.


[My Blog]
All roads lead to JavaRanch
santosh joshi
Greenhorn

Joined: Aug 20, 2007
Posts: 21
Thanks Guys,

I am using a different trigger for this purpose

Thanks

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Quartz Cron Expression