Jump to content


Photo

date


  • Please log in to reply
6 replies to this topic

#1 onthespot

onthespot
  • Members
  • PipPipPip
  • Advanced Member
  • 424 posts

Posted 20 August 2006 - 04:49 PM

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

#2 spelltwister

spelltwister
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 20 August 2006 - 04:51 PM

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

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 20 August 2006 - 04:56 PM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 20 August 2006 - 05:07 PM

ALTER TABLE tablename 
ADD datejoined VARCHAR(255) default="";

Or something similar to that.

http://mysql.com/doc...lter-table.html

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 20 August 2006 - 05:10 PM

use in the database INT ok.


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 20 August 2006 - 05:20 PM

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.

#7 onthespot

onthespot
  • Members
  • PipPipPip
  • Advanced Member
  • 424 posts

Posted 20 August 2006 - 07:00 PM

ok thankyou, i will do just that




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users