1

Having two dates (a start and end one), how can I get the difference out in minutes, excluding the hours ranging from 19:00:00 to 08:59:59 and weekends for example?

It can not be a duplicate of this, they do not mention any exclusion of the minutes of certain hours or the weekend.

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
Simnme
  • 11
  • 2
  • What did you try already, as you are supposed to provide some code here to ask for help? Either start with TIMESTAMPDIFF then find out how many weekends you crossed to remove their time (might get trickier if your dates start or stop inside a weekend). And same for nights. Or do a loop, from start date to next coming weekend/night start, then to same weekend/night end up to end date or next weekend and so on until you reach end date. Also it seems you are trying to compute like working hours or something like that... but then you have national days off to count in that case too... – Patrick Mevzek Aug 09 '18 at 16:45
  • Completely wrong duplicate given here... The link does not relate at all to this question. A more correct duplicate is: https://stackoverflow.com/questions/35760696/mysql-average-difference-between-timestamps-excluding-weekends-and-out-of-bus?rq=1 aka *MySQL - Average difference between timestamps, excluding weekends and out of business hours* – Patrick Mevzek Aug 10 '18 at 15:16
  • thanks @PatrickMevzek, I've resolved by myself – Simnme Aug 13 '18 at 10:42

0 Answers0