Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
There has to be an easier way!!!!!
Message
De
01/01/2007 09:04:46
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01180722
Message ID:
01181193
Vues:
10
>There has to be an easier way!!!!!
>
>A request for our Scheduling module to handle recurring day of the months. For example, the 1st and 3rd Wednesday of every month, etc. I created a cumbersome routine and really feel that there should be some easier way to determine the 'Week Day' of the month.
>
>Looking for suggestions or a means to easily identify if any date would satisfy a 'Week Day' of the month such as above. Any suggestions would be welcome.
>
>Thanks in advance
this is from Sergey Berezniker:
* Program....:  NthDowOfMonth.PRG
* Version....: 
* Author.....: Sergey Berezniker
* Date.......: 12/27/06
* Compiler...: Visual FoxPro 09.00.0000.3504 for Windows for Windows
* Abstract...: 
* 			..: 
* Changes....: 

 *FUNCTION NthDowOfMonth(tnYear, tnMonth, tnWeekNum, tcDow)
LPARAMETERS 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
Peter Cortiel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform