Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Week by Month
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01180294
Message ID:
01180320
Views:
19
>>
>>FUNCTION FourthFridayOfMonth(tnYear, tnMonth)
>>LOCAL lnDOW
>>lnDOW = DOW(DATE(tnYear, tnMonth, 01), 7)
>>RETURN DATE(tnYear, tnMonth, 7 - lnDow + 1 + 3*7)
>>
>>* or one-liner
>>FUNCTION FourthFridayOfMonth(tnYear, tnMonth)
>>RETURN DATE(tnYear, tnMonth, 7 - DOW(DATE(tnYear, tnMonth, 01), 7) + 1 + 3*7)
>>
>>
>>
>
>Sergey,
>
>Just curious, why do you use DATE(tnYear, tnMonth, 01), 7) to get Saturday, not Friday?

The DOW(,7) returns Friday as the last day of the week (7) which makes consequent calculations simpler.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform