Calculate Working days / Holidays

  • 23 April 2018
  • 1 reply
  • 16 views

Hello,

 

I am working on Leave Request application and seeking help on following. I have added controls as follows.

 

Start Date: Select Leave Start Date

End Date: Select Leave End Date

Number of Days: This calculates total number of leaves days.

 

Here I am using Date Difference expression to calculate difference between two selected dates. Now I want to calculate only week days (Mon-Fri) and exclude holidays if selected between Start Date and End Date.

 

Any idea on how to achieve this? Please help.

 

Thanks

Sachin

 

 

 

 


1 reply

Badge +9

Hi Sachin,


 


Out of the Box I don’t think this is possible, but if you save your Public Holidays in SQL you might be able to use an SQL script for this calculation.


 


You can create a stored procedure for it, then use SmartObject to call the stored procedure.


 


Here's a SQL solution I found on stackoverflow:


 


https://stackoverflow.com/questions/10330836/how-to-count-date-difference-excluding-weekend-and-holidays-in-mysql


 


Regards


Jean

Reply