>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
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