Jump to content

How to get week # of Month


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

Recommended Posts

seems simple ...

 

There's week of year function,,

 

How do I get  get Week Of Month ?

 

 

 thank you

Link to comment
Share on other sites

for instance what week is may 27  what

 

weekof month()   

 

===   5th week of month    etc

 

 

and thanks this sunday

Link to comment
Share on other sites

for instance what week is may 27  what

 

weekof month()   

 

===   5th week of month    etc

 

 

and thanks this sunday

 

 

That's not really an answer. I am going to take a guess here and suggest =

 

Let ( [
firstOfMonth = Date ( Month (  date ) ; 1 ; Year ( date ) ) ;
sun = firstOfMonth - DayOfWeek ( firstOfMonth ) + 1
] ;
Div ( date - sun ; 7 ) + 1
)

 

This behaves in a manner similar to WeekOfYear() i.e. a week starts on Sunday and fractions of weeks occurring at the beginning or end of the month count as full weeks,

Link to comment
Share on other sites

To re-iterate comments point that the answer to this question depends entirely on how you want to define "week of month", here is a real-life example:

Min (
	Ceiling ( Day ( Get ( CurrentDate ) ) / 7 ) ;
	4
)

 

In this case, I needed the first 7 days of the month to be the first week, next 7 the second week and so on, returning a max value of 4, regardless of how many days were in the month. This was a very particular scenario, though, so I wouldn't expect it to be what you were looking for, but we can't know that without clarification of the question.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

thanks thats exactly what i need.. thought I ask right.. id would know this math statement.. 

Link to comment
Share on other sites

This topic is 4111 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.