Cron Expression: What exactly is the difference between ? and * in a cron expression? - quartz-scheduler

It appears to me that both mean "any of the available values". What exactly in the difference between them?

* means every possible value in the field. ? means you don't care about the value. It's used when you have two fields that may contradict each other. The common example being the day of month and day of week fields. Consider, for example a cron specification for running at 10AM on the first day of every month:
0 0 10 1 * ? *
Now let's break it down:
Seconds: 0 - we want it to run on 10:00:00
Minutes: 0 - we want it to run on 10:00:00
Hours: 10 - we want it to run on 10:00:00
Day of month: 1 - we want it to run of the 1st of every month
Month: * - we want it to run on every month (e.g., January 1st, February 1st, etc.)
Day of week: ? - we don't care about the day of week. The cron should run on the 1st of every month, regardless of whether it's a Sunday, a Monday, etc.
Year: * - we want it to run on every year

From Quartz Scheduler
* ("all values") - used to select all values within a field. For example, "*" in the minute field means "every minute".
? ("no specific value") - useful when you need to specify something in
one of the two fields in which the character is allowed, but not the
other. For example, if I want my trigger to fire on a particular day
of the month (say, the 10th), but don't care what day of the week that
happens to be, I would put "10" in the day-of-month field, and "?" in
the day-of-week field. See the examples below for clarification.

The * character is used to specify all values. For example, "*" in the minute field means " every minute ".
The ? character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the two fields, but not the other. See the examples below for clarification.
You can look more here:
http://docs.netkernel.org/book/view/book:mod:cron/doc:mod:cron:cronexpression
Also if you need to create a Cron expression you can use this: http://www.cronmaker.com/

* means every time. According to the position, it will be:
every second, minute, hour, day, month.
? means that it would be
chosen by other field. So ? doesn't add filter, but it
wouldn't run every time.
? is used for setting the day, as it might be a day of month or the day of week. So if you choose the day of month (like the 1-st day of month), than you put ? in the day of week, by which you show, that it would be not every day of week, but only those days which are allowed by other conditions. And vice versa, if you set day of week, you put ? in the day of month.

Related

RRULE for every other week except last week of month

I need an RRULE for every other Saturday except the last week of the month. I tried to create one with a weekly frequency, but didn't know how to apply an exception for the last week of the month:
RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=SA
I also tried creating a rule with a monthly frequency, which allowed me to skip the last week of the month, but I didn't know how to make it every other week:
RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=SA;BYSETPOS=-2,-3,-4,-5
I looked through the specification, but I'm not seeing anything that makes this possible.
The secret to the solution here is that BYMONTHDAY can be negative like BYSETPOS. This allows one to exclude the last 7 days of each month even though the number of days in the month varies. Your DTSTART should be on a SATURDAY, so one doesn't really need the BYDAY=SA
This rrule works in google calendar (if DTSTART is on Saturday and generally for any every 2nd week but not the last week rule for any day of week specified by the DTSTART):
RRULE:FREQ=WEEKLY;INTERVAL=2;BYMONTHDAY=-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,-25,-26,-27,-28,-29,-30,-31
See test calendar:
https://calendar.google.com/calendar/u/0?cid=ZXBwdWE4N2RwZm5xODVic3JydDJzaXFsY3NAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ
Spec: https://datatracker.ietf.org/doc/html/rfc2445#page-43
and
https://icalevents.com/2447-need-to-know-the-possible-combinations-for-repeating-dates-an-ical-cheatsheet/ for the expansion & contraction (limiting) rules & combinations

Recurring calendar event on First of the month

I have a recurring calendar event on 1st of each month, when 1st falls on Sat/Sun is it possible for iCal to schedule it for last working day Fri?
If I understood you correctly the following RRULE should do the trick:
FREQ=MONTHLY;BYDAY=1MO,1TU,1WE,1TH,1FR,-1FR;BYMONTHDAY=1,-1,-2
See the next 100 instances
It basically does two things:
Iterate the first weekday that falls on the 1st day of the month
Iterate the last Friday of each month that falls on the last or 2nd last day of the month (in which cases the 1st of the next month falls on Saturday or Sunday).
A slightly shorter version that should yield the same results is
FREQ=MONTHLY;BYDAY=1MO,1TU,1WE,1TH,FR;BYMONTHDAY=1,-1,-2
This just iterates every Friday, but only keeps the ones that fall on the first, last and 2nd last day of each month. Though it looks like the recurrence expansion service above disagrees. That's probably a bug.
I'm assuming you mean "the last working day Friday of the previous month", in which case I don't think it possible. It would mean that some months have 2 occurrences when others have 0, which doesn't really work.
You could easily do the first working day of the month (the 1st, or the first Monday):
FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1
Or, you could do always the last working day of the month:
FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1

What Date Time Format is this?

What date time format is this : 735715:37344280
<ExecDateTOD Friendly="Monday April 27, 2015 10:23:00am">735715:37344280</ExecDateTOD>
It's found in C:\Windows\Performance\WinSAT\DataStore\file_name.xml, and is the date time when the Windows Experience Index Assessment test was run.
Any idea how it's structured and can be edited? I need to change it to a previous years Date.
It seems that this format is called VariantTime, in MSDN the call to convert time is called VariantTimeToSystemTime. So it may be number of days, with decimal part after the :.
For the timestamp 735715:37344280
The first number (the one before the colon) is the number of days since the year 0:
735715 / 365 = 2015.66
The second number (the one after the colon) is the number of milliseconds that have passed within the current day.
37344280 / (1000*60*60) = 10.37 hours since start of day
So you can just subtract 365 days from the first number to obtain the previous year like this:
<ExecDateTOD Friendly="Monday April 27, 2014 10:23:00am">735350:37344280</ExecDateTOD>
Note that there were no leap years in either 2015 or 2014, so these year are exactly 365 days long.
Here is a link to a page with another <ExecDateTOD> tag where you can compare: http://www.scribd.com/doc/82935159/2012-01-30-16-00-49-986-Formal-assessment-Recent-WinSAT#scribd
I think that if you subtract 365 from that number, you'll be in previous year.
That number seems to be days since the year 0. The first part might be the number of days, taking into account leap years, etc). The second part the time coded in some way.

iCalendar (RFC5545) recurrence rule multiple times a day

How can I make an event occur multiple times a day using the RRULE specified in RFC5545?
Lets say I would like an event to happen every other week on Monday and Friday at 11AM and 18PM. Is it possible to format the RRULE like something as the following:
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,FR;[TIMES=110000,180000]
Thanks
you have to use the byhour
The BYHOUR rule part specifies a COMMA-
separated list of hours of the day. Valid values are 0 to 23.
so that would be :
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,FR;BYHOUR=11,18

Representing repetitive dates

Repetitive Dates:
Billing cycles come in a lot of different formats, for example: "the first of the month", "third Friday of the month", or "first weekday on or after 21st day after the 13th of the month" (thanks visa!). My goal is to be able to represent these different billing cycles in one easily parsed database text field.
You forgot weekend processing. If my bill is due on a Sunday, I want it to show up on Friday. That kind of thing. I think there are three possibilities:
Always before the weekend
Always after the weekend
If it's Saturday, Friday, and if it's Sunday, Monday
Current solution:
YYYY/MM/DD+YY/MM/DD+DOW
all blocks (delimited by +) are optional as well as all parts of each block.
first block denotes the starting date
if blank - denotes today
if missing portion - denotes all... ie "//12" would denote the 12th of the month every month.
negative denotes counting from the end of the period.. ie "//-1" denotes the last day of the month
overruns are carried into the next month ie "//40" would be 40 days after the first of the month
second block denotes the change in date between repetitions
if blank - set date (from first block)
Add present portions - ie "/1/" means every month after the given starting date
third block denotes the day of the week the calculated date should be moved to
available are [m,t,w,r,f,s,d,b] (7 days of the week, "business day")
Calculation:
Calculation start on the date specified in the first block, filling in the missing portions with the date the record is added.
the DOW is then added to get a valid starting date. This is the first date of the event.
the next date is calculated by adding the second block to the last calculated first block and adding the DOW to get the next date.
Examples:
on march 12th, 2008 - "2008/3/12"
the first of the month every month - "//1+/1/"
third Friday of the month every month - "//21+/1/+f"
first weekday on or after 21st day after the 13th of the month - "//34+/1/+b"
every 2 weeks from today - "+//14"
last day of every second month starting with march - "/3/-1+/2/"