Jump to content

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

Recommended Posts

Posted

Hello all.

 

I want a script or custom function to calculate: 

whether a specific day is xth day of month?

 

For e.g.

 

If date field is 2nd (xth) Monday (any day) of month - Result should be true

otherwise it should result into false.

 

If there would be any custom function, it will be great!!

 

Thanks.

 

Posted
  On 3/30/2015 at 10:55 AM, Tattwam said:
If date field is 2nd (xth) Monday (any day) of month - Result should be true

otherwise it should result into false.

 

The temptation here is to start by calculating the actual date that is the x-th weekday of the given month. That is certainly possible, but not as easy as the alternative - considering you only want a true-or-false result. So we only need to test for:

  • is the given date the requested day-of-week?
  • is the given date in the requested week of the month?
DayofWeek ( Datefield ) = weekday
and
Ceiling ( Day ( Datefield ) / 7 ) = x

where weekday is a number between 1 (Sunday) and 7 (Saturday) and x is the number of the occurrence you are looking for. 

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