Count days between dates, with complex rules

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Lovepreet323
Posts: 29
Joined: Fri Jun 17, 2022 9:45 am

Count days between dates, with complex rules

Post by Lovepreet323 »

How to calculate days correctly between two days excluding 2nd and 4th Saturday and all sunday and excluding holidays.
Start date is counted as zero day
End date should be yesterday date

Example:-
start date is (27-Nov-2025)+1
End date is today()-1
In between Sunday on 30-Nov-2025
This givs me result as 4, but actual days is 5

 Edit: Changed subject, was How to calculate days correctly between two days excluding 2nd and 4th Saturday and all sunday and excluding holidays 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Last edited by MrProgrammer on Thu Dec 04, 2025 5:09 pm, edited 1 time in total.
Reason: Edited topic's subject to provide a summary, not all the rules
OpenOffice 4.0 on Windows 10
Post Reply