Jump to content


This topic is now archived and is closed to further replies.


Days between 2 dates

Recommended Posts

I have a users table and within that I have a field that places the date the member registersd.

What I need is a way to show on a web page the number of (full) days they have been registered for.

I've already connected to the database and pulled out the date, giving it the name $regdate

I know that i need to simply take $regdate from the current date but im left with a long number as this is not formatted, think its the number of seconds they've been a member, rather than days.

Currently using:
[code]$daysold = (date() - $regdate);[/code]
to work this out.

Anyone know how I can

Share this post

Link to post
Share on other sites
[code]SELECT ( TO_DAYS(CURDATE()) - TO_DAYS(reg_date)) as days_reg FROM users[/code]

Share this post

Link to post
Share on other sites


Important Information

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.