Php Date Week

0 views
Skip to first unread message

Destini Armstrong

unread,
Aug 4, 2024, 3:04:13 PM8/4/24
to giafunkbenon
Thereis no single answer to your question, the notion of week numbers depends on the system you are trying to apply.

I've found this one which was found in this thread: -Preparation-Blending/Calculating-Week-Number-using-DateTimeFor...


I have week numbers and year number in separate columns in my data-set and I was needing to convert that directly to the Monday Start Date of that week (ISO Standard). I attempted to use the above solution but found some issues in the fact that it anchors it's calculation on Jan 1. So to try and resolve this I dug in the rabbit hole deep. I'd like to show you the summarized version of that journey of discovery I had:


I figured out that the Week Number standard most of us experience is tied to the ISO 8601 date and time standard that assigns each week a number on the Gregorian calendar. There are some years that have 53 weeks and some week 1's start with a previous years date then there is leap years that make things a little more confusing. So needing to know the methodology of how the ISO standard is developing week numbers, I searched and found the ISO standard wiki here which goes through all the possibilities for week 1 vs week 53 in a nice table which is ultimately tied to the day of week that Dec 31 falls on. Here is what it says:


"If 31 December is on a Monday or Tuesday it is in week 01 of the next year. If it is on a Wednesday, it is in week 01 of the next year in common years and week 53 in leap years. If it is on a Thursday, it is in week 53 of the year just ending; if on a Friday or Saturday it is in week 52 of the year just ending. If on a Sunday, it is in week 52 of the year just ending in common years and week 01 of the next year in leap years."


Pretty simple right? Yeah I didn't think so either. UNTIL searched "Calculating a date given the year week number 'Formula' " and found this website which had an excel solution to this problem:


I'm newer to Alteryx so there are probably 20 better ways to do what I did and make it cleaner than it is (sorry for the funky column names). Also, I wish I knew more about building macros since I'm sure this is a great candidate for a macro (Maybe someone wants to do that?!). OR EVEN BETTER YET, Alteryx wants to add this inherently into their DateTime Conversion tool??? (I guy can dream)


I'm trying include a date range with counting the number of applicants within various depts, in certain date ranges, but it's saying incorrect argument set. =COUNTIFS(DISTINCT([Name of Requestor]:[Name of Requestor], [Submission Date]:[Submission Date], AND(@cell > DATE (2023, 9, 30), @cell


I've got some quarterly data that I'd like to format a bit. I'd like to change the "week-1 2015" labels (see attached image) to something like "Jan 1-7 2015" etc. I can't seem to find which beast mode formula I could use to accomplish this. Thanks in advance!


There are a few options that I have used in the past. I'll outline them below. The main strategy is to shift the date in each row of your data backwards (or forwards) and then extract the portion you want.


Note that even though this looks like a date, Domo will consider it a character value. The upshot is that you cannot use the date grain selector on this value, all cards using this Beast Mode will always be locked to weekly.


You could get really fancy and do some conditional logic around whether the month at the beginning of the week matches the month at the end of the week (likewise for the year). For each case you would need something similar to the last example. That gets a little complex for my taste but it could certainly be done.


no you can't shift it with the out of the box functionality. You would have to load it in as part of your dataset or build a beast mode but you will lose the time grain functionality if you build a customer date field.


how do I create a Week of Date based on dates during the week? For example the Delivery date of 10/21 I want populate the Week Delivery Date with the week number Date. Do I need to create and additional week number column or is there a formula I can use?


Currently the week starts on Monday on the calendar that appears when I schedule tasks and reminders and it's causing me no end of scheduling headaches and missed appointments. I really need the week to start on Sunday but the option to change the start day seems to have disappeared out of the settings menu. Can anyone help? I can't find the answer to this anywhere and I've tried everything I can think of in the Windows app and online to fix it.


So, here's the trick: it's not in the app settings, weirdly enough. On Windows, you gotta go to your system settings > Time & Language > Date & Time. Scroll down and change the "First day of the week" setting to Sunday.


I >thinkSlightly off-topic, but all of the "Sunday week starters" in the Western World are a mystery to me. The work week, school week, financial week, and government services week all start on Mondays, and so I've never understood why anyone would want their calendars to start on Sunday!


It's a Canadian thing, maybe? Carry-over from the UK? Everything starts on Monday but the calendar has always been SMTWTFS. My PC date/time settings are Sunday-start. I uninstalled the Windows app and I'm going to see if I can change it via the web. I remember several updates back there was the option to start your calendar on Sunday or Monday, but as I said it looks like that's gone now.


You folks aren't looking nearly far enough back. In very ancient Jewish and Christian tradition, God created the world on Sunday. Good enough to be God's first day.... So the tradition of the Sunday - Saturday week settled in in "the West," and largely remains. Doesn't bother me, I'm retired, nothing starts on Monday for me either! ?


OK - It seems to be specific to the Windows app on my setup, so I'm guessing it's something built into that app. The web app is Sun-Sat when scheduling things, whether or not my VPN is connected. Well, that's disappointing. I prefer to use the app for toggling purposes, but I guess I'll have to wait for an update.


Just on a practical level, I have all of my calendars start on Sunday because it makes it easy to see what I have coming up on Monday. Whenever I've changed a calendar to start on a Monday, I've regretted it when I wake up at 10 am (semi-retired, lucky me!) to find I was supposed to be somewhere at 9 am. With calendars starting on Sunday, it's more likely I'll bump into a screen that shows that pesky early appointment -- even if I'm just looking at YouTube videos or working online crossword puzzles.


It would be helpful to find a way to do this. All my settings everywhere, as well as all physical calendars I have, start on Sunday. It's easy to click the wrong thing when Evernote is the only thing I have starting on Monday.


I need to display the week start date and end date when I filter for week, i.e max week should display and along with start date and end date of that week. similarly when i filter for other weeks also particular start date and end date of that week.


I've report experience that I want to show/report data within the last week. Data for the report is run only on a Friday, covering Friday 5pm to following Friday at same time (inc weekends) and I don't want to lose the visibility of information as "7 days" pass, same for "1 week".



Is there an easy way, just to filter for "Date Last Week"?


Hi, thanks for the reply.



I should have perhaps been more specific - the last 1 week counts back 7 days from today and I'm also looking to have this filter used to create dynamic text.



eg; Number of objects created last week; 999 (filter being "Date is Last Week", a change of xxx.



So, last week one or even last 7 days moves forward with every new calendar day. A "is Last Week" option would "cement" the return to a set period.


Thanks for reading! I'm trying to create an open ticket tracker that shows tickets as green, yellow, orange, and red depending on if they're just open in the current week, past two weeks, past month, or older than a month. I think I've got everything except those bins. I figure the easiest way is to make a custom column that bins them based on date functions, but it doesn't seem to be working. I'm new to Power BI, though, so maybe I've missed something.

3a8082e126
Reply all
Reply to author
Forward
0 new messages