Roy Harper
Coder
I am trying to calculate the total leave days based on two dates. I tried using datediff and timestampdiff but it gives me the wrong result.
For example I input:
leaveStart = "2022-04-26"
leaveEnd = "2022-04-27"
So the total leave days should be 2 days because the leave is from 26 to 27.
datediff and timestampdiff basically gives me the difference between two dates.
Any ideas how to compute it properly? I may try adding 1 day to the result but i just want to know if there's a better way to do it.
For example I input:
leaveStart = "2022-04-26"
leaveEnd = "2022-04-27"
So the total leave days should be 2 days because the leave is from 26 to 27.
datediff and timestampdiff basically gives me the difference between two dates.
Any ideas how to compute it properly? I may try adding 1 day to the result but i just want to know if there's a better way to do it.