Calculate the number of days between two dates
How do you calculate the number of days between two dates excluding weekends? Can you please provide example code?
This is not a programming question as much as a simple question of method and mathematics. Procedurally, you will want to set up some variables like start_date, end_date, total_days, start_DAY. Now you can use the @Weekday function (If you are using Formula Language, or the Weekday() function if you are using LotusScript to figure out what day of the week you start on. You could then figure out what the next day is (in case you started on a Saturday, you would need to know that the next day is Sunday). You could then take the remaining integer value, divide it by 7, multiply by 2, then choose if you need to discard the remainder or use @Weekday() on the end_date. It is not an easy function to perform but with the variables I list and the @Weekday function, you have all you need. Remember that when you subtract one date from another, you must divide the result by 86400 to get the number of days (because subtracting dates results in a number of seconds.