April 19, 200619 yr Hello, I've spent some time trying to get this to work, but have not had much success. I'm looking for a way to a field equal to the week of the month. For instance week 1, week 2, week 3, week 4, week 5, and another one to display the date of the first day of that week. For this purpose the week starts on Monday. So for April I would get Week 1 = 4/3/06 Week 2 = 4/10/06 Week 3 = 4/17/06 Week 4 = 4/24/06 Week 5 = (N/A for April) Thanks
April 19, 200619 yr IIUC, you want the dates of all Mondays in a particular month/year. This will return the date of the first Monday: Let ( [ firstOfMonth = Date ( yourMonth ; 1 ; yourYear ) ] ; firstOfMonth + Mod ( 2 - DayofWeek ( firstOfMonth ) ; 7 ) ) The second Monday is a week later, so just add 7 to the result, and so on. The fifth Monday might fall in the next month, so you might want to check if the resulting date's month is equal to the given month.
April 19, 200619 yr Could you somehow use the WeekOfYearFiscal function vs. the week of the first monday of that month? I started to work on something but don't have time to finish, I have attached it as a work in progress. Not sure if its on the right track, the records that have a result of 0 or 99 would somehow have to be worked out, I think the other dates are correct but it wouldn't be the first time dates had tripped me up. WeekOfMonth.zip
Create an account or sign in to comment