Skip to Content
author's profile photo Former Member
Former Member

Business Days/Hours in Crystal 8.0

Post Author: mkrug

CA Forum: Older Products

There is supposed to be a function file that is to be downloaded and registered (according to old whitepapers). Would anyone know where that might be found?

Thanks much!

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 07:17 PM

    Post Author: Miken

    CA Forum: Older Products

    you might want to use this function instead. You'll have to change FDay and LDay to be your inputs.

    Local DateTimeVar FDay := #10/12/2007 07:30#;Local DateTimeVar LDay := #10/15/2007 06:01#;TimeVar BusinessStartTime := TimeValue("8:00 am");TimeVar BusinessEndTime := TimeValue("17:00");

    //Move First Day and Last Day within "Business Hours"if TimeValue(FDay) > BusinessEndTime then FDay := datetime(date(FDay) + 1, BusinessStartTime)else if TimeValue(FDay) < BusinessStartTime then FDay := datetime(date(FDay), BusinessStartTime);

    if TimeValue(LDay) > BusinessEndTime then LDay := datetime(date(LDay),BusinessEndTime)else if TimeValue(LDay) < BusinessStartTime then LDay := datetime(date(LDay) - 1, BusinessEndTime);

    // shift weekend days to appropriate weekdayif ((DayOfWeek(LDay) = crsaturday) or (DayOfWeek(LDay) = crsunday)) then ( LDay:= DateAdd("d",1-Dayofweek(LDay,crFriday),LDay); LDay:= datetime(date(LDay),BusinessEndTime););if ((DayOfWeek(FDay) = crsaturday) or (DayOfWeek(FDay) = crsunday)) then ( FDay:= DateAdd("d",3-Dayofweek(FDay,crSaturday),FDay); FDay:= datetime(date(FDay),BusinessStartTime););

    if (LDay < FDay) then 0 else ( ((DateDiff ("d", FDay, LDay) - DateDiff ("ww", FDay, LDay, crSaturday) - DateDiff ("ww", FDay, LDay, crSunday))*9) + ((Hour(LDay)-hour(FDay))) + ((minute(LDay)-minute(FDay))/60))

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.