For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > March 2005 > current date-time in php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author current date-time in php
vishal

2005-03-29, 3:57 pm

i want to store the date and time when the user registered i.e. the
record is entered in my table.

so how can i achieve this????

should i use php or mysql to achieve this??

which is more proper and how can i get date-time ???


thxs

frizzle

2005-03-29, 3:57 pm

Both ways are proper, you could use http://nl2.php.net/date as a php
function, and insert that into the DB, or use the handy mySQL
filed-type:
TIMESTAMP which automatically picks the current date/time when a record
is created...

Jean-Baptiste Nizet

2005-03-29, 3:57 pm

AFAIK, the MySQL timestamp values are also automatically updated when
the database row is modified, which doesn't seem to be what the OP
asked for. I would use a DATETIME field, and the MySQL function NOW().

JB.

boclair

2005-03-29, 3:57 pm

vishal wrote:
> i want to store the date and time when the user registered i.e. the
> record is entered in my table.
>
> so how can i achieve this????
>
> should i use php or mysql to achieve this??
>
> which is more proper and how can i get date-time ???
>


perhaps date("U")?

Louise
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com