I'm using this query: SELECT NOW() - date AS elapsed FROM ...
Date column is TIMESTAMP. It returns 41632 when elapsed time is about 4 hours and 20 minutes. It's not timestamp. What is it?
Or is there any better way to get elapsed time and generate with PHP like this: "2 minutes ago" "3 hours ago" "yesterday 22:32"
Thanks a lot!
Use the TimeStampDiff function
select TIMESTAMPDIFF(MINUTE, NOW(), timestamp_column) FROM my_table
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