Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Week by Month
Message
 
 
To
27/12/2006 06:22:32
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:
01180447
Views:
14
Here's more compact version
FUNCTION NthDowOfMonth(tnYear, tnMonth, tnWeekNum, tcDow)
LOCAL lnDOW, ldDate, lnDowPos
lnDowPos = AT(UPPER(PADR(tcDow,3)), "SAT SUN MON TUE WED THU FRI")
IF lnDowPos = 0
	ldDate = {}
ELSE
	TRY 
		lnDOW  = DOW(DATE(tnYear, tnMonth, 01), INT(lnDowPos/4) + 1)
		ldDate = DATE(tnYear, tnMonth, 7 - lnDOW + 1 + (tnWeekNum -1)*7)
	CATCH
		ldDate = {}
	ENDTRY
ENDIF	
RETURN ldDate
>I dared to expand it to make it more generic
>one can E.G. get the second tuesday of the month:
>but it is not so compact anymore
>
<snip>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform