WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: mcvpjd3 on March 13, 2014, 03:24:04 PM

Title: Calculate days, but exclude weekends
Post by: mcvpjd3 on March 13, 2014, 03:24:04 PM
Just being lazy (efficient?) here, has anyone got a bit of script for calculating the number of days between 2 dates, but excluding weekends?

Thanks
Title: Re: Calculate days, but exclude weekends
Post by: stanl on March 14, 2014, 03:59:39 AM
If you have Office Installed just call the WorkSheetFunction NetWorkDays(). It even has an optional argument to exclude holidays between 2 dates.
Title: Re: Calculate days, but exclude weekends
Post by: hdsouza on March 14, 2014, 07:30:33 AM
You can loop through each day during the period
Then with the Timedate() function  if the first item == "sat" or == "sun"  dont count that day
Title: Re: Calculate days, but exclude weekends
Post by: Deana on March 17, 2014, 10:18:44 AM
Here are some possible algorithms you can use: http://stackoverflow.com/questions/1617049/calculate-the-number-of-business-days-between-two-dates. The would simply need to be converted to WIL code.