Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating days of the week
Message
De
08/02/2002 06:19:24
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
08/02/2002 00:42:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00617141
Message ID:
00617196
Vues:
17
>Hi All
>1.Can anybody help with a function to calculate the number of weekdays between to dates ??
>2.Why will a date printed in a report ignore the format that is set for that field in the SET DATE option. e.g. The date print as dd-mm-ccyy regardless if the setting is DMY, BRITISH, SHORT ???
>
>Thanx in advance
>
>Koot Coetzer
function CountWorkDays
lparameters tdD1, tdD2, tnWorkDaysInWeek
* First day of workday is Monday
tnWorkDaysInWeek = iif(empty(tnWorkDaysInWeek),5,tnWorkDaysInWeek)
return floor(abs(tdD2-tdD1)/7) * tnWorkDaysInWeek + ;
  min(dow(max(tdD1,tdD2),2),tnWorkDaysInWeek) - ;
  dow(min(tdD1,tdD2),2) + 1
'set date' and many other 'set' are scoped to current datasession. You can find a list of them under 'Datasession' topic.
Before report set date to your taste (better do that in form.load or form.DE beforeopentables). It'd save you from a lot of troubles especially when you use private datasession (my personal recommendation though arguable in cases). Also check field's format too. It could be overridden there.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform