Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number of Work Days between two DateTime Values

Status
Not open for further replies.

dnboughton

Technical User
Oct 26, 2005
14
US
I hope I can ask this question fairly intelligently...

I would like to use Ken Hamady's formula for finding the number of work days between two DateTime values, but I would like my DateVar Start to = a parameter value {?StartDate}.

Ken's example is this:
Local DateVar Start := {StartDate}; // place your Starting Date here
Local DateVar End := {EndDate}; // place your Ending Date here

I want to do this:
Local DateVar Start := {?StartDate}; // place my Starting DateTime parameter field here
Local DateVar End := {?EndDate}; // place my Ending DateTime parameter field here

It is asking for a Date for the DateVar obviously. What do I need to do?





 
Its complaining because you are trying to make a DateVar equal a DateTime.

Are you sure you want to use DateTime parameters, if you do then try

Local DateVar Start := todate({?StartDate});
Local DateVar End := todate({?EndDate});

Ian
 
I have to run to catch my train but, this would be the function for a Datetime var. I'll research tomorrow if it can be done with datevar

Local DateTimeVar Start := {StartDate};
Local DateTimeVar End := {EndDate};
global numbervar diff;

//remove saturday and sunday this does not take holidays into account

diff := DateDiff ("h", Start, End) -
DateDiff ("ww", Start, End, crSaturday) -
DateDiff ("ww", Start, End, crSunday) ;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top