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



  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...