Warning: Undefined array key "birthday_search" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 173

Warning: Undefined array key "joindate" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 190

Warning: Undefined array key "posts" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 191

Warning: Undefined array key "posts" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 197

Warning: Undefined array key "userid" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 6509

Warning: Undefined array key "userid" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 212

Warning: Undefined array key "privacy_options" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/api/user.php on line 251

Warning: Undefined array key "userid" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 4998

Warning: Undefined array key "userid" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 1585

Warning: Undefined array key "lastactivity" in phar:///home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb/vb.phar/library/user.php on line 1601

Warning: Trying to access array offset on value of type bool in /home/duptmor/public_html/prod.mcpressonline.com/forum/core/vb5/route/profile.php on line 74
calculate business days between 2 dates - MC Press Online Forums

Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

calculate business days between 2 dates

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • calculate business days between 2 dates

    Can anyone tell me how to go about calculating the business days between two dates? Is there a bif for the day of the week? Thanks

  • #2
    The CEEDAYS API will return day of the week, but that will not necessarily get you to the business days.

    You must also consider holidays, etc.

    Establishing a file that hallmarks all non-business days is the only way you can make this work considering that every company has some minute differences.

    Once you know how many non-business days occur in your range, you can subtract that from the result of the SUBDUR opcode.

    Dave

    Comment


    • #3
      Originally posted by kambam633 View Post
      Can anyone tell me how to go about calculating the business days between two dates? Is there a bif for the day of the week? Thanks
      Hi Normally you would have a file the holds the working or none working days.
      if it holds working days then a simply sql
      select count(*) from calfile where Caldate between FromDate and Todate

      Dave
      Last edited by daveslateree@gmail.com; 11-03-2010, 08:19 AM. Reason: typo

      Comment


      • #4
        We have a calendar file on our system that holds info against each date - its real date as an *iso value (eg.2010-11-03), its numeric value(eg.20101103), character value (eg '20101103' useful for chaining from legacy file dates). There is also a Y/N flag for weekends and another for Bank holidays. Then we can calc the no of total days, weekdays and business days (including shutdown between xmas and new year) thus:

        /free


        select count(caactdate) into :NoDays from calendarp
        where caactdate between :fromdate and :todate;


        select count(caactdate) into :NoDays from calendarp
        where caactdate between :fromdate and :todate
        and caweekend <> 'Y';

        select count(caactdate) into :NoDays from calendarp
        where caactdate between :fromdate and :todate
        and cadayofyr < 360
        and caweekend <> 'Y'
        and cabankhol <> 'Y';
        /end-free
        Last edited by Guest; 11-03-2010, 10:42 AM. Reason: incomplete

        Comment

        Working...
        X