master82 Posted March 22, 2006 Share Posted March 22, 2006 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 $regdateI 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 Quote Link to comment https://forums.phpfreaks.com/topic/5532-days-between-2-dates/ Share on other sites More sharing options...
Barand Posted March 22, 2006 Share Posted March 22, 2006 [code]SELECT ( TO_DAYS(CURDATE()) - TO_DAYS(reg_date)) as days_reg FROM users[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5532-days-between-2-dates/#findComment-19759 Share on other sites More sharing options...
master82 Posted March 23, 2006 Author Share Posted March 23, 2006 Your a star - thank you! Quote Link to comment https://forums.phpfreaks.com/topic/5532-days-between-2-dates/#findComment-19811 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.