master82 Posted March 23, 2006 Share Posted March 23, 2006 In my users table in my mysql database I have the field "created", in the format of CURRENT_TIMESTAMP (which upon inserting a new record uses NOW() as a default) resulting in a format of 2006-03-21 12:48:14.I use this as when a member registers it automatically places the date and time within.Now what I need is to create a php page with all the members information, including the number of days they have been a member.I've tried to place the created date into a variable and used NOW(), DATE(), TIME(), CURDATE(), CURTIME() etc to get the current date (subtracting one from the other) but it doesnt seem to work when trying to subtract the two dates.Also I need the result displayed in number of days.Anyone know how I can proceed to achieve this? Quote Link to comment Share on other sites More sharing options...
Barand Posted March 24, 2006 Share Posted March 24, 2006 [code]SELECT ( TO_DAYS(CURDATE()) - TO_DAYS(created) ) as totaldays[/code] Quote Link to comment 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.