Jump to content

Dates


Muncey

Recommended Posts

Basically im putting a join date into the database but i don't want it displayed as a date, i want it as pure numbers so that i can use it to work out things such as how long they've been a member, comments per day (by dividing the posts by how many days they've been a member) ect ect

 

So whats the best way of putting that into the database? I have a vBulletin forum and looked in the database at what they had for the join date and i saw stuff like 112823... is that seconds or something?

 

I also need to display the date as a real date xx/xx/xx so that must be possible aswell.

Link to comment
https://forums.phpfreaks.com/topic/60612-dates/
Share on other sites

Store it is type DATE.

 

You can easily calc how long they have been a member by using

 

SELECT DATEDIFF(joindate, CURDATE()) as totaldays FROM mytablename.

 

Also it's easy to format to any output display style you want using Mysql DATE_FORMAT() function or by using PHP date() function.

Link to comment
https://forums.phpfreaks.com/topic/60612-dates/#findComment-301576
Share on other sites

Unsure of what you mean, what exactly am i storing as a date type? Im inporting $date into the database under join_date... what do i need $date to equal in order to make the date display as something i can use for various things such as how many days been a member but also display join date as xx/xx/xx

Link to comment
https://forums.phpfreaks.com/topic/60612-dates/#findComment-301606
Share on other sites

Archived

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

×
×
  • Create New...

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.