What is the best way to put the current date into MySQL?

    I suppose you have an attribute in one of your tables by the type of "date" or maybe "datetime". When you INSERT or UPDATE a record in that table you might use this SQL-query to do so :

    "INSERT INTO thetable SET thedate=NOW() WHERE id='myid';"

    The whole secret is the NOW() function in MySQL which (depending on how you format your date/datetime-attrib. will store the current date(and possibly time) in the attribute.

    Hint : Have a look at that NOW() and the DATE/DATETIME-column-type. s

      Write a Reply...