Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Work days between two dates - finally!
Message
De
09/06/2003 10:32:27
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
09/06/2003 09:10:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00797684
Message ID:
00797963
Vues:
18
>Hi Cetin,
>
>this program for:
>
>({^2003/6/10},{^2003/6/16},k) return fixed 5 for every k=0-7.
>
>Fabio
lparameters td1, td2, tnWorkDaysInWeek
* First day of workday is Monday - 2
Local lnDays,lnNotWorkedDays
If td2 < td1
	Local ldTemp
	ldTemp = td1
	td1 = td2
	td2 = ldTemp 
EndIf
lnNotWorkedDays = Iif( tnWorkDaysInWeek < 7,CountDays(td1, td2, 1),0)
For ix=tnWorkDaysInWeek+2 to 7
	lnNotWorkedDays = lnNotWorkedDays + CountDays(td1, td2, ix)
EndFor
return  td2 - td1 + 1 - lnNotWorkedDays

Function CountDays
Lparameters tdDate1, tdDate2,tnDOW
Return Floor((tdDate2-tdDate1)/7) + ;
	Iif(Dow(tdDate2,tnDow)<Dow(tdDate1,tnDow),1,0)+;
	Iif(Dow(tdDate1,tnDow)=1,1,0)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform