I have a scheduled task that needs to run three times a day, on each weekday. The setup surrounding the task is Coldfusion, and it is in the Crontime format. It should run at 11:30, 15:45 and 18:30 server time.
For some reason the task is occasionally running on weekends, which it should not do.
Here are the three strings for each of the days:
0 30 11 ? * 1-5
0 45 15 ? * 1-5
0 30 18 ? * 1-5
Can anyone point out to me why the task is sometimes running on weekends? Is there a mistake in my string?
The Coldfusion crontime documentation can be found here:
According to This, 1 = Sunday.
Days-of-Week can be specified as values between 1 and 7 (1 = Sunday) or by using the strings SUN, MON, TUE, WED, THU, FRI and SAT.
Try replacing 1-5 with MON-FRI?
An example of a complete cron-expression is the string "0 0 12 ? * WED" - which means "every Wednesday at 12:00:00 pm".
Individual sub-expressions can contain ranges and/or lists. For example, the day of week field in the previous (which reads "WED") example could be replaced with "MON-FRI", "MON,WED,FRI", or even "MON-WED,SAT".
Related
I have a table of values for orders per month by region that looks like this:
Orders Table
Orders (YTD)
Month
Year
1
Jan
2021
4
Feb
2021
4
Mar
2021
5
Apr
2021
14
May
2021
16
Jun
2021
17
Jul
2021
19
Aug
2021
22
Sep
2021
24
Oct
2021
34
Nov
2021
35
Dec
2021
1
Jan
2022
3
Feb
2022
4
Mar
2022
Along with a table that orders the months in sequence as below, that will be modelled to order the months in the first table so that they appear in sequence in graphs.
Monthly Sequence Table
Month Sequence
Month
1
Jan
2
Feb
3
Mar
4
Apr
5
May
6
Jun
7
Jul
8
Aug
9
Sep
10
Oct
11
Nov
12
Dec
Upon closer inspection of my data, I have realised that the number of orders per month are not the raw figure per month, but a cumulative total for every order in the calendar year so far (new orders for month + orders for preceding month). Firstly, I want to calculate the correct sum of orders per year, which should actually just be the MAX month from the orders table. Of course in most years this will be December, but for the current year it needs to be the latest month. I wanted to use a measure to calculate the MAX 'Monthly Sequence Table'[Month Sequence] number from each table, by year. I thought maybe a filter function would be used but could not work out exactly how to do this in DAX.
Secondly, and similarly, I want to calculate the actual number of orders per each individual month using DAX. In this case, I want to take the Orders (YTD) total for that month/year combination and subtract it from its immediately preceding month. What would the formula look like for this?
Thanks in advance.
EDIT - I added all the last 50 texts, I saw that were sent from various people, unfortunately, it's not an automatic email...
list of all the text is HERE
I'm struggling to find a matched pattern that will identify the needed items (date, start time, time zone) from this text:
1 April 20 16:00-16:30 Israel Time
Tomorrow, Wed Feb 12, 08:00-9:00 AM IST(IL)
Tomorrow, Wed Jan 22, 09:30-10:00 PM PST
11-May-20 19:00-20:30 Israel Time
The start time is an easy one: (\d+:\d+)- but I'm not sure what to be done with the other words and digits.
Based on the data you provided, something like this would do it, with 3 captures as requested:
(\d+[-\s]\w+[-\s]\d+|\w+ \d+),?\s(\d+\:\d+)\-\d+\:\d+\s(?:AM\s|PM\s)?(.*)
Online reference
Let's say I develop a ticket application that runs on windows. A given ticket has a validity of 3 hours. Now if I want to print a ticket on 28th of March 2020 (GMT+1, Germany) at 11 PM (23:00:00) it should be valid until 2 AM the next morning. (I manipulate my system time for testing)
Problem is, on the 29th DST-change happens: at 2 AM time will be set to 3 AM.
Due to DST the ticket is only valid until 1 AM (so technically only 2 hours), even though the actual time-leap happens later that day.
Here is what I do:
for the current time I use struct tm myTime;
myTime.tm_mday; \* = 28 *\
myTime.tm_hour; \* = 23 *\
struct tm newTime;
newTime.tm_mday = myTime.tm_mday; \* also done for remaining fields *\
newTime.tm_hour = myTime.tm_hour + 3; \* = 26 *\
no problem so far. On any other day the 26 hours will be converted to the following day 2 AM.
But if I call time_t result = _mktime64( newTime ); in this specific case, the resulting timestamp (e.g. 1585440205) will have mday = 29 and hour = 1 (when converted)
Is there another option, that calculates the time hour-precise, so that my ticket-validity doesn't lose one hour? (I assume _mktime64 recognizes the DST-change and manipulates all times for the day, no matter if they are before or after the actual time change at 2 AM)
I am trying to create a variance measure in PowerBI.
This is the data that I have,
Month Year MonthNo Value
Jan 2016 1 700
Feb 2016 2 800
March 2016 3 900
April 2016 4 750
.
.
Jan 2017 13 690
Feb 2017 14 730
And My variance for the Month Number 7 should be like,
`{Avg(values(4,5,6) - Value(7)} / Value(7)`
i.e (Average of last 3 months value - current month value) / Current month value
How to do this in Power BI? Thanks.
If it is okay for you to use a column, I believe you could add one with this code to get what you want:
Variance = (CALCULATE(AVERAGEX(Sheet1,Sheet1[Value]),FILTER(FILTER(Sheet1,Sheet1[MonthNo]<=EARLIER(Sheet1[MonthNo])-1),Sheet1[MonthNo]>=EARLIER(Sheet1[MonthNo])-3))-Sheet1[Value])/Sheet1[Value]
You'll need to replace all instances of Sheet1 with the name of your table.
It'll give you something like this:
This is my first question on Stack.
I am working on a booking site that relies heavily on searching and finding full weeks of accommodation. Most user searches will be on weeknumber of the year, eg. week 27 for the first week of july.
It is important that the user does not need to fill in year when searching for accommodation, and so the only thing we will get from the user is the weeknumber.
How can I get the year from the week given by the user considering that it always has to be the next upcoming occurrence of that week number?
(There is a gotcha in this. I could get the upcoming week 27 by doing something like this:
def week
week = 27
Date.commercial(Date.current.year + 1, week, 1) # gives the first day of the week
end
But that would only be right until the 1 of January, after that it would be looking for week 27 of 2015.)
You could compare the current calendar week with Date.current.cweek (Reference) with your number.
require 'active_support/core_ext' # Already included in Rails
def calendar_week(week)
now = Date.current
year = now.cweek < week ? now.year : now.year + 1
Date.commercial(year, week, 1)
end
p calendar_week(49)
# => Mon, 02 Dec 2013
p calendar_week(1)
# => Mon, 30 Dec 2013 # don't know if that's the way calendar weeks are counted
p calendar_week(27)
# => Mon, 30 Jun 2014