Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8728345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:37:07+00:00 2026-06-13T08:37:07+00:00

I have a report creator program made in Java that needs to run every

  • 0

I have a report creator program made in Java that needs to run every Monday and I used Quartz for my scheduling part. The trick is, the amount of reports needed to be generated varies; depending if the Monday is the first of the month, or the succeeding Mondays.

To achieve this, what i did is create a trigger for each Monday of the month with the first Monday pointing to a specific job class while the rest of the Mondays(triggers) point to another job class.

        .withIdentity("trigger1", "group1")
        .withSchedule(cronSchedule("0 1 0 ? 1/1 MON#1 *"))
        .build();

        .withIdentity("trigger2", "group1")
        .withSchedule(cronSchedule("0 1 0 ? 1/1 MON#2 *"))
        .build();

and so on until i reach

        .withIdentity("trigger5", "group1")
        .withSchedule(cronSchedule("0 1 0 ? 1/1 MON#5 *"))
        .build();

It reached MON#5 because there could be 5 Mondays in a month; like this October. This is fine, it works (I think), but my question is this. Is there a way to combine my cron schedule so that I will only need one trigger for the succeeding mondays? Something like;

        .withSchedule(cronSchedule("0 1 0 ? 1/1 MON#2,MON#3,MON#4,MON#5 *"))

If there is, please kindly enlighten me. If I’m just missing something, something in my programming, or if there exists an unknown page in the labyrinth which is the web that leads me to the truth, then kindly point me to the right direction.

Your kind words are greatly appreciated. Thanks

p.s: I included a cron tag even though it says it’s for UNIX computers. I believe there is little or no difference between Quartz cron and Unix cron. If there is, then please do tell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:37:08+00:00Added an answer on June 13, 2026 at 8:37 am

    It looks like there is no formal solution for your problem.

    Here is a quote from Quartz 2.0 documentation:

    The ‘#’ character is allowed for the day-of-week field. This character is used to specify “the nth” XXX day of the month. For example, the value of “6#3” in the day-of-week field means the third Friday of the month (day 6 = Friday and “#3” = the 3rd one in the month). Other examples: “2#1” = the first Monday of the month and “4#5” = the fifth Wednesday of the month. Note that if you specify “#5” and there is not 5 of the given day-of-week in the month, then no firing will occur that month. If the ‘#’ character is used, there can only be one expression in the day-of-week field (“3#1,6#3” is not valid, since there are two expressions).

    There is also an open bug on this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a report that I run from a system once a week, and
I have a report which has a list that is used to group data
I have a report that is getting info from bsis, bsas, bsid, bsad, vbrk,
I have a report in InfoView that has in a footer showing the effective
I have a report that is basically a form with multiple empty fields and
I'm using Crystal Report with VB.NET in Visual Studio 2005. I have report that
I have a report that I am trying to get the difference between two
I have a report that I would like to display with some data hidden
I have a report that runs a stored proc: EXEC ra_spProjectCalendar @Month, @Year, @ProjectID
I have report data is that structured as followed: RecID | ReportView1 | Name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.