Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating days of the week
Message
From
08/02/2002 06:19:24
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/02/2002 00:42:31
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00617141
Message ID:
00617196
Views:
16
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform