date_diff

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
php69
New php-forum User
New php-forum User
Posts: 2
Joined: Sat Jan 12, 2019 5:54 pm

Sat Jan 12, 2019 6:21 pm

I have a date variable called $date_entered extracted from mysql in the format 2019-01-12 16:18:56
I would like to find out how many minutes between now and that date/time stamp. I can't figure out how to do that.

Thanks

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 775
Joined: Mon Feb 22, 2016 5:52 pm

Sun Jan 13, 2019 10:04 am

I don't know which version of MySQL you are using, but I'm sure3 that you can gather from this what to do https://dev.mysql.com/doc/refman/5.5/en ... tions.html

php69
New php-forum User
New php-forum User
Posts: 2
Joined: Sat Jan 12, 2019 5:54 pm

Mon Jan 14, 2019 5:03 pm

It is for the raspberry pi 14.14
I need to do this in php though

chorn
php-forum Fan User
php-forum Fan User
Posts: 577
Joined: Fri Apr 01, 2016 2:18 am

Mon Jan 14, 2019 11:26 pm

Use the DateTime class, it has a diff-function.

Post Reply