4 Replies Latest reply: Nov 22, 2011 2:21 AM by Sokkorn Cheav RSS

    NetWorkDays include Satursday

    Sokkorn Cheav

      Hi All,

       

      Please take a look below function

      networkdays( start:date, end_date {, holiday} )

      Returns the number of working days (Monday-Friday) between and including start_date and end_date.

       

      Actually the requirement is include Satursday as working day.

      So how can I get number of working days (Monday-Satursday) using networkdays function?

       

      Your suggestion is much appreciate.

       

      Regards,

      Sokkorn

        • NetWorkDays include Satursday

          Hi,

           

          If your requirement needs to include all saturadys then you can go this way

           

          1)Subtract the two dates...you will get number of days

           

          2) Week(date1)-Week(date2) ...this will give you the week difference

          Every week has one sunday

           

          3) From no of days subtract the week you will get number days without sunday.

           

           

          Thanks

            • NetWorkDays include Satursday
              Sokkorn Cheav

              Hi Yogesh,

               

              Thanks for reply. This one is work find if we don't think about public holiday.

              My requirement is count day exclude [Public Holiday] + [Sunday] from period.

               

              Let see example:

              IDStartDateEndDate
              101-11-201115-11-2011

               

              In this period have 2 sunday(on 6 and 13) and 1 public holiday (on 10). So working day should be 11.

               

              Note: Public holiday is another one table seperate from above table.

               

              Any idea besides this?

               

              Regards,

              Sokkorn

                • NetWorkDays include Satursday

                  Sokkom,

                   

                  Firstly refer to my above post wherein you can calculate number of days excluding sunday.

                   

                  Now to exclude public holiday here is the logic:

                   

                  (Number of days) - (networkdays(date1,date2)-networkdays(date1,date2,holiday_list))

                   

                  description is as follows: 

                  networkdays(date1,date2) : this will return number of workdays

                   

                  networkdays(date1,date2,holiday_list) : this will returns number of actual days

                   

                  (Total_Number_of_days) - (workdays-actualdays) = days excluding sunday and public holidays