|
Posted by Adam Plocher on 09/27/40 11:37
PHP has some great date functions for formatting dates however you
could possibly want. First take a look at www.php.net/date for a list
of formats.
Notice that the second (optional) parameter to the date function is a
timestamp parameter. You must convert your date/time into a unix
timestamp but this can easily be achieved with the strtotime() function
(www.php.net/strtotime).
So basically you would want to do:
echo date("Y-m-d H:i:s", strtotime("December 25, 2005 11:55 PM"));
// this should return 2005-12-25 23:55:00 - this is the format I
usually use when inserting into MySQL
Note that strtotime should be able to take in just about ANY format of
date and time.
Navigation:
[Reply to this message]
|