Problem solve Get help with specific problems with your technologies, process and projects.

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.

Dig Deeper on Domino Resources - Part 2



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury