Posted by: Matt Fletcher | August 22nd, 2008

Using PHP to create a MySQL DATETIME

I can never ever find this information on the web when I need it, so I’m recreating here to save my own time, and that of anyone else who stumbles upon it.

$datetime = date('Y-m-d H:i:s') ;

Non-geeks, you can keep on walking, thanks.


Responses

  1. thanks for that. I was looking for that querry

  2. Glad to know it’s of use to someone else too. In the month since I posted this, I’ve used it at least 4 times myself!

  3. Keep in mind most of the time its more efficent to use Database functions like MySQL NOW(). http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_now

  4. @Matt – thank-you for the info. Neat and to the point.

    ps. loved this:

    “Non-geeks, you can keep on walking, thanks.”


Leave a response

Your response:

Categories