I have some date like 2019-07-03 10:25:43 I want a week of day for that date
I tried this but I got Thursday
%{YEAR:date_year}-%{MONTHNUM:date_month}-%{MONTHDAY:date_mday} %{HOUR:time_hour}:?%{MINUTE:time_minute}:?%{SECOND:time_second}
the actual output should be Wednesday for that date but it shows Thursday
Related
Based on the current date Carbon :: now (), there is a need to get the date from the current week by the ordinal number of the day of the week from 1 to 7 or by the name of the day of the week (Monday, Tuesday ...).
Example:
Let's say the current date is 2020-12-12;
There is a need to find out what date will be for Sunday of the current week by the name Sunday or by the number of the day of the week 7;
Is there a Slack reminder for last day of the month so that the reminder will occur on the 31st, 30th, or the 28th depending on the month?
Does something like /remind #channel to do X on the last day of the month work?
This syntax seems to work in setting a reminder for the last day of every month:
/remind #someone [What] on the 31st of every month
There is a way but i could not find the best one to do it:
/remind #someone [What] on the 28th of every month
This will remind you on the 28th day of every month. Unfortunately there is no way of working this around. You can set a reminder for every 1st day of the month too:
/remind #someone [What] every month
You can set a reminder for every month but its not that easy to manage:
/remind #someone [What] on the 31st of every January
and so on.
I've just created 12 reminders for myself for the next year
/remind #yourname to "Fill time-report" at 9:00 on Sep 30
/remind #yourname to "Fill time-report" at 9:00 on Oct 31 # Note that October has 31 days
...
This way you can adjust for last weekday of the month being a holiday in your country
Why does the number of the week of the year start with 1 in 2017 and 0 in 2018?
Date.strptime('2017-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %U') #2017-01-01 01
Date.strptime('2018-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %U') #2018-01-01 00
From the Ruby docs
Week number:
The week 1 of YYYY starts with a Sunday or Monday (according to %U
or %W). The days in the year before the first week are in week 0.
%U - Week number of the year. The week starts with Sunday. (00..53)
So it seems that Ruby identifies the "first week" (week 1) as starting with the first Sunday of the year. Anything that happens to come before that exists in week 0. 2017 happened to start on a Sunday, so the first day started the first week. However, 2018 started on a Monday, so week 1 of 2018 will start on January 7th, the first Sunday of the year.
To show week numbers according to ISO-8601, use %V:
# %V - Week number of the week-based year (01..53)
Date.strptime('2017-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %V') #2017-01-01 52
Date.strptime('2018-01-01', '%Y-%m-%d').strftime('%Y-%m-%d %V') #2018-01-01 01
In general:
Week number according to the ISO-8601 standard, weeks starting on Monday. The first week of the year is the week that contains that year's first Thursday (='First 4-day week').
https://www.epochconverter.com/weeknumbers
All:
I wonder if there is easy way to group timestamp by order of week, for example:
A month usually has 5 or 4 weeks, once given a timestamp( something like UTC time 1483465353929 which is 1/3/2017 that should be put into 1st week group, say we use the first Monday of a month as the starting of the first week of that month, and if the timestamp is early than the first Monday like 1/1/2017, it should be put into previous month's last week group which is 5th week) How can I quickly identify its week order? Any implementation will be appreciated
Thanks
I want to schedule to run a shell script on a Thursday which comes after the second Tuesday of every month. How to schedule this in crontab?
The second Tuesday of the month will occur between the 8th and the 14th inclusive, so set the day-of-week field to 4 (Thursday), and the day-of-month field to 10-16 (that is, a range adjusted to be two days after the range of the month's second Tuesday).