current date-time in php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vishal

    current date-time in php

    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

    #2
    Re: current date-time in php

    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...

    Comment

    • Jean-Baptiste Nizet

      #3
      Re: current date-time in php

      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.

      Comment

      • boclair

        #4
        Re: current date-time in php

        vishal wrote:[color=blue]
        > 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 ???
        >[/color]

        perhaps date("U")?

        Louise

        Comment

        Working...