This is a function that I wrote to handle this same situation:
# --- Function to format date output ---
function makedate($format, $indate)
{
$temp = explode("-", $indate);
$fulldate = mktime(0, 0, 0, $temp[1], $temp[2], $temp[0]);
$temp = date($format, $fulldate);
return ($temp);
}
Call it like this:
echo makedate("m/d/Y", $myrow[departdate]); # returns 11/30/2002
echo makedate("F d, Y", $myrow[departdate]); # returns November 30, 2002
You can use any of the standard date formatting commands in the function call.
HTH!
Peter
At 10:10 AM 11/19/2002 -0500, Edward Peloke wrote:
I am pulling from a datetime field in mysql. The actual data looks like this: 2002-11-30 00:00:00 When I output the data to the page, I want it to appear as 11/30/2002. I want to use a php date format. I do not want it formatted as it comes out of the db. But date("m/d/y", $myrow[departdate]) returns 12/31/69. How can I do this?THanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- - - - - - - - - - - - - - - - - - - - - Fourth Realm Solutions [EMAIL PROTECTED] http://www.fourthrealm.com Tel: 519-739-1652 - - - - - - - - - - - - - - - - - - - - - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php