Jump to content

Week Number of Month


This topic is 6574 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 6574 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.