T
T
TechNOIR2019-09-16 11:41:58
MySQL
TechNOIR, 2019-09-16 11:41:58

MySQL. How to get the difference between two dates excluding weekends?

Hello.
Have date#1 = 2017-01-26 10:59:17
Have date#2 = 2017-01-27 11:34:55
How to get the difference between them while excluding holidays?
In this example, 28.29 is the weekend. Accordingly, somehow these 48 hours must be excluded from the difference ..
Thank you in advance!
PS
So far I'm counting the difference like this:
TIMESTAMPDIFF(SECOND, date1, date2)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2019-09-16
@Adamos

1. Weekends are not just weekends.
2. Saturday and Sunday are not necessarily days off.
3. There are not necessarily 24 hours in a day.
pp. 1 and 2 are regulated by law, 3 robots can count themselves for the current time zone.

K
Konstantin Tsvetkov, 2019-09-16
@tsklab

Create and use the "Calendar" table, where weekends and holidays are indicated, if necessary, working hours. Data can be taken, for example, a production calendar .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question