A job is executed in monday every two week during a month [closed] - quartz-scheduler

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm using Quartz job scheduler to execute a job. I want this job being executed in Monday every two week in one month. For example, for this Month(July), I will expect this job be executed in July 4 and July 18, then how I can write the cronExpression of quartz?

For this to happen correctly, you will need to have 2 seperate cronTriggers.
0 0 12 ? 1/1 MON#1 *
This reads fire at 12pm on the 1st Monday of every month.
0 0 12 ? 1/1 MON#3 *
This reads fire at 12pm on the 3rd Monday of every month.
You could also go with something less explicit to avoid having 2 seperate cronTriggers:
0 0 12 4/14 * ?
This reads fire at 12pm every 14 days every month, starting on the 4th day of the month.
Adjusting the 12 in the expression will set the time you want the job to fire. You can also adjust the 4/14 statement to match your needs. For example, 1/15 would equal every 15 days every month, starting on the 1st day of the month.

Related

How the target response Date is calculate in an Entiltment Process Milestone?

I am new to the Entitlement Process and Milestones using the OOTB implementations. In my org, two business hours (1 for SLA and 1 for OLA) set with different timezone. Each business hours configured to work 9 AM to 6 PM.
Extending the question from link : What will be the time trigger value based on the Business hour in salesforce? .
I have some SLA which has 5 days of deadline. As per formula ((EOB-SOB) * MPH) * NOBD), I need to get clarification on below if its correct:
EOB = Assume 5 days deadline, so 14/05/17
SOB = Today, so 09/05/17
MPH = 60 minutes
NOB = 5, What do I need to consider here? As No. of business day means 5 days
here, as 5 days of deadline?? Please clarify.
One thing which is observed for 5 days business: as per formula 5*60*5=1500 or 5*60*9 (no of business hours)=2700. As per 2nd logic I implemented, but OOTB not showing 5 days, its only showing the 2 days why ?
First of all, regarding: What will be the time trigger value based on the Business hour in salesforce?
EOB, stood for end of Business day, so 19:00 or 7 PM
SOB, was 10 AM in your sample
I have cleared up my original answer on that question as well.
Current question
Target Response (Days) showing 2 for 45 hours....
Ah, eh, yes tricky and often asked for. The 2 is simple 45/24 and then rounded off...
It is not business days!
There are some ideas on the Idea Exchange for this, but for now this is how it is.

Quartz - schedule jobs every two Weeks regardless of the start time

What is the cron expression for the following schedule :
Monday and Tuesday at 8:00 am, every 2 weeks.
Can we define "Every 3 weeks" regardless of the the start time ? (I don't care if it's every 3 weeks starting from the first week of the month or year, I want to run it for 5 years and literally every 3 weeks)
You can't find a cron expression that meets your schedule.
For example this howto states, that:
You need a SimpleTrigger or CalendarIntervalTrigger to schedule
biweekly fire points.
I think you need two Simple Triggers to define a schedule like "Monday and Tuesday at 8:00 am every 2 weeks", namely one biweekly trigger for each monday, and just like that one biweekly trigger for each tuesday.
Similarly you could tackle the "Every 3 weeks" problem.

Confused with dates and days in cron jobs

I am having trouble understanding how dates and days work together in a cron job.
Say I have the following command:
0 23 5 1 3 COMMAND
This translates to 23:00, on 5th of January, on Wednesday.
The problem is, that January 5th is a Sunday. How exactly will this command work out? Is the command going to be executed for both January 5th AND for every Wednesday on the month January? Or will it execute just the '5 1' bit?
I am really sorry if it is a really basic question and possibly stupid but to me it really does not make any sense.
Thank you in advance!
Commands are executed by cron when the minute, hour, and month of year fields match the current time, and at least one of the two day fields (day of month, or day of week) match
Ref: Man Page

How to get days in between two dates in jasper reports [duplicate]

This question already has answers here:
How to create a single expression displaying time difference between two Date's as years, months, days, hours, minutes, seconds
(1 answer)
Calculating Time and Date difference
(1 answer)
Closed 4 years ago.
I have two dates, one is assign_date (date assigned) and the other one is complt_date (date completed). I have to get the number of days in between the two dates.
DATE ASSIGNED : 04-27-2012
DATE COMPLETED: 04-27-2012
THUS DAYS : 0
NOT COMPLETED (AS OF 03-13-2013)
DATE ASSIGNED : 04-20-2012
DATE COMPLETED:
THUS DAYS : 327
You can do this at the query level, this could be more easier.
For MySQL database there is a function called DATEDIFF:-
ex:- SELECT DATEDIFF(complt_date,assign_date) AS DiffDate

What is the first/last week of a month? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
If someone were to say something happens in the first or last week of some month, how would you define that span?
Background
I'm working on a library that needs to handle this kind of thing in an intuitive way, but my intuition doesn't claim one case or the other.
I can make it select different behavior but still need a good default.
For a concrete example I'll just to pick an random month: July 2008
s m t w r f s
--------------------
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
(Note: I'll assume the week starts with Sunday but the question could be asked re Monday as well)
What span is the first week of the month?
June 29 - July 5 -- the week that includes the first
July 6 - 12 -- the first week that is all the way into the month
The second week is just the 7 days following the first right?
What span is the last week of the month?
July 27 - Aug 2 -- ditto but the last day
July 20 - 26 -- ditto but the last week
Non wiki comments welcome
There is no answer because it varies even inside a country.
However, this source seems to think it's defined by the ISO standard as the first week that contains a thursday. However the above source says that the ISO standard does not list a specification for 'first week of the month'
More than 300 chars - sorry!
The ISO 8601 standard defines the first week of the YEAR as:
calendar week number
ordinal number which identifies a calendar week within its calendar year according to the rule that the first
calendar week of a year is that one which includes the first Thursday of that year and that the last calendar
week of a calendar year is the week immediately preceding the first calendar week of the next calendar year
There is nothing in ISO 8601 about the first week of the month because, as has been noted, the definition varies by country (and even by company, for example). Oh, and the standard says that weeks start on Monday.
If you are building a library, you should allow the user to choose how they want to handle it either by having methods that return the first/last full/partial week of the month or by passing an argument that indicates whether you want the full/partial week. Clearly document whichever is the default if you provide methods that don't require the specification.
public Week GetFirstFullWeekOfMonth( DateTime forDate ) { }
public Week GetFirstPartialWeekOfMonth( DateTime forDate ) { }
Or
public Week GetFirstWeekOfMonth( DateTime forDate, bool includePartial ) {}
The first week of the month is the first week that is all the way int the month
July 6 - 12
The first week of the month is the week that includes the first
June 29 - July 5
The last week of the month is the week that includes the last day
July 27 - Aug 2
The last week of the month is the last week that is all the way int the month
July 20 - 26
My definition would be the first week is the week of the first working day in the month,
and likewise the last week is the week of the last working day in the month.
The first week of the month is the first week that owns 4 or more days of the defined week period. (Not really but I thought I'd throw it in as an option)
The first week of the month is week 0 - the week that has the first day of the month.
The last week is the week with the last day of the month
Hence the weeknumber of the last week of july IS THE SAME as the weeknumber of the first week of august
** UNLESS **
the month in question ends on the last day of the last week, in wich case the following month would start on the first day of the new week and have a different weeknumber
:)
There's a fairly obvious option you are missing. The first week of the month is the seven days starting with the first day of the month. Hence, in your example, the first week would be Tuesday, the 1st through Monday, the 7th. This way, the first through 4th weeks would always be fully contained within the month, and only the 5th week would cross over.
Talk to your users and ask them what they think it means when the program says to them "First week of the month" and "Last week of the month".