Find number of working days between two dates in Mysql

This which helps to find number of working days between two dates in Mysql. There is no specific or inbuilt function in mysql, For that we need to use the SQL query as below.

[sql]
SELECT 5 * ((DATEDIFF(@end_date, @start_date) ) DIV 7) + MID(‘0123455501234445012333450122234501101234000123450’, 7 * WEEKDAY(@start_date) + WEEKDAY(@end_date) + 1, 1)
[/sql]

For the Reference, i have given the URL: http://stackoverflow.com/questions/1828948/mysql-function-to-find-the-number-of-working-days-between-two-dates, Kindly review this link for more information about the Days calculation.

Permanent link to this article: https://blog.openshell.in/2013/08/find-number-of-working-days-between-two-dates-in-mysql/

Leave a Reply

Your email address will not be published.