Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Counting Days
Message
De
17/10/2000 06:35:05
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
16/10/2000 14:53:20
Erin Eby
Mission Critical Software
Gainesville, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00429936
Message ID:
00430213
Vues:
15
>Hi there. I tried to find the "Stupid Questions" category for this one, but it didn't exist. :) Is there a way to count the number of business days (which would be everyday but Sat. and Sun.) that have occurred from Jan. 1st to today? just wondering....tia.

My .2 cents Erin.
Do not depent on cdow() unless you always use localized versions. OTOH string operations would slow down calculation. There is already dow() instead. Instead of calculating with a loop you could directly query week() and multiply by workdays - IMHO faster.

lnFullWeeks = max(week(date(),1,2),0)
lnFirstWeekDays = max(8-dow(date(year(date()),1,1),2) - 2,0)
lnThisWeekDays = iif(week(date(),1,2)=1,0,min(dow(date(),2),5))
lnWorkDays = lnFullWeeks * 5 + lnFirstWeekDays + lnThisWeekDays

This calculates workdays excluding holidays.
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