Jump to content

Archived

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

onthespot

date

Recommended Posts

how do i add a date row on my user registration table for my site! i want the date of when they signed up to be stored in the DB and be used on their profiles

Share this post


Link to post
Share on other sites
use the time() function and then use the date() function to convert it to something that is more friendly

example

$now = time(); 'put this into the database

$joined = date("M j Y", $now); '$now from the database

Share this post


Link to post
Share on other sites
look up the date function try to understand the timestamp as it's very inportant in programming as you codes become more better ok.

good luck.

Share this post


Link to post
Share on other sites
[code]ALTER TABLE tablename
ADD datejoined VARCHAR(255) default="";[/code]

Or something similar to that.

http://mysql.com/doc/refman/5.0/en/alter-table.html

Share this post


Link to post
Share on other sites
It was an example...

I would recommend using MySQL's date type.  It's the easiest to work with, especially if you are going to be doing ordering or date manipulation.

Aside from that, I would go with varchar, because you are able to store a lot of different formats, including php's unix timestamp (which I think is what redarrow is saying to use INT), but you can also use YYYY-MM-DD if you chose, or any other format.

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.