Thursday, 8 November 2018

Get no.of working days in selected calendar

static void WorkingdaysInPeriod_WD(Args _args)
{
    WorkCalendarSched workCalendarSched;
   date start;
   date end;
   counter workingdays;
   counter totaldays;
   CalendarId primCalendar="Standaard";
   ;
   start=str2date("1-11-2014",123);
   end= str2Date("1-12-2014",123);
    workCalendarSched = new workCalendarSched();
    while(start<end)
   {
    totaldays++;

       if(workCalendarSched.isdateopen(primCalendar,start)==true)
           {
               workingdays++;
           }
        start++;
    }
    info(strfmt("Total days: : %1",totaldays));
    info(strfmt("Total working days: : %1",workingdays));
}

No comments:

Post a Comment