Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date occurance for specific day of the week per month.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00187864
Message ID:
00187870
Views:
20
The following formula gives you the following day of week after (including) the ldDate date:

ldDate + mod(lnDay - dow(ldDate, 1), 7)

where lnDay = 1 (Sunday), = 2 (Monday), etc.

If you want the 3rd Thursday of the month, call it with ldDate = the first day of the month and lnDay = 5 and add 14:

ldDate + mod(lnDay - dow(ldDate, 1), 7) + 14

To get the first day of the month when you have the month and the year:

ld1stDay = ctod("^" + str(lnYear, 4) + "/" + str(lnMonth, 2) + "/01")

Vlad

>For example, how would I calculate the dates for every third Thursday of the month for the next six months and store those dates in an array for later processing.
>
>If anyone has done this type of calculation and is willing to share with me the solution, I would greatly appreciate it. Hate to reinvent the wheel.
>
>TIA,
>
>James Moore
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform