Welcome! Log In Create A New Profile

Advanced

Second tuesday of month

Posted by Willy 
Second tuesday of month
December 11, 2018 07:49AM
Hello,

There is a function that returns the number of the week.

Is there also something to calculate de date of the 3th wednesday or second tuesday of a given month.

Thanks
Willy Hermans
Re: Second tuesday of month
December 11, 2018 04:04PM
Hi Willy,

I don't think so. You have to code it yourself.

Regards, Stefan
Re: Second tuesday of month
December 11, 2018 04:16PM
Hi Willy,

AFAIK there's not, so you need to create your own function.
Something like this (not tested):

Function get_Weekday(nMonth,nDay,nRank)
dDate is date
nWeekDay is int
dDate=FirstDayOfMonth(nMonth)
nWeekDay=DateToDay(dDate)
IF nWeekDay>nDay THEN dDate..Day+=7  //add one extra week
dDate..Day+=7*(nRank-1)-nWeekDay+nDay

RESULT dDate

Kind regards,
Piet



Edited 1 time(s). Last edit at 12/11/2018 04:18PM by pietvanz.
Re: Second tuesday of month
December 12, 2018 07:42AM
Thanks a lot.

I've completed it.

FUNCTION get_Weekday(nYear,nMonth,nDay,nRank)
dDate is Date
nWeekDay is int
dDate=FirstDayOfMonth(nYear,nMonth)
nWeekDay=DateToDay(dDate)
IF nWeekDay>nDay THEN dDate..Day+=7  //add one extra week
dDate..Day+=7*(nRank-1)-nWeekDay+nDay

RESULT dDate

Willy.
Re: Second tuesday of month
December 12, 2018 08:23AM
Hi Willy, that's looking great!

Kind regards,
Guenter Predl
office@windev.at
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: