I'm trying to calculate how many minutes have elapsed between a saved DateTime and NOW(), how can I accomplish this?
Use the TIMESTAMPDIFF()
built-in function:
SELECT TIMESTAMPDIFF(MINUTE, my_datatime_col, now())
You may have to swap the datetime values to get the right sign (positive/negative) on the result if the column is before/after "now".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With