Thanks for your help. The alternative worked.
I forgot to mention that I am using mysql on a raspberry pi which to my understanding has some limitations.
Thanks for the suggestions. I get null when I use the timestampdiff function. I changed my data type from char(8) to time to match your structure. Here is my actual query.
SELECT action
, NOW() as Now
, action_time
, timestampdiff(MINUTE, now(), action_time) as mins
FROM schedules;
Result
action Now action_time mins
1 2020-12-07 21:09:14 07:40:00 NULL
0 2020-12-07 21:09:14 16:45:00 NULL
I've been stuck on this issue for a few days. The answer is probably basic, but I can't figure it out. I have a variable originating from a mysql database $action_time. Contents are like $action_time="16:45:00".
I need to get the time difference in minutes from the current time. I can obviously do without the seconds.
I believe to get the current date, it is date("h:i:s")
Thanks
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.