Salesman0Gil Posted April 19, 2006 Posted April 19, 2006 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
Fitch Posted April 19, 2006 Posted April 19, 2006 Is this what you're looking for? http://www.briandunning.com/cf/343
comment Posted April 19, 2006 Posted April 19, 2006 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.
sbg2 Posted April 19, 2006 Posted April 19, 2006 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
Salesman0Gil Posted April 20, 2006 Author Posted April 20, 2006 Thanks. That file is excatly what I was looking for.
Recommended Posts
This topic is 6854 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now