I have a field which is a datetime, this field returns the following date/time:
2018-05-16 14:37:45
What I would like is to be able to subtract 5 hours from that date and have it look like this:
2018-05-16 09:37:45
I was able to achieve it with the function DATE_ADD
but I like to believe that there might be an easier way to achieve what I want. Any other way to achieve it that is easier?
DATE_ADD(ov.hora_llegada, INTERVAL -5 HOUR)
MySQL has DATE_SUB() :
And then use it however you want, for example:
If you want to test it first to make sure it's doing what you want: