edavo
asked on
Reformat date using PHP
Right now, I place a date on my page using the echo $rows['date']; variable from a query. It works fine, but it is printed out as:
2011-09-10
How do I use php to show the output as only:
09/10
2011-09-10
How do I use php to show the output as only:
09/10
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this. http://us.php.net/manual/en/function.explode.php
$nudate = explode("-", $rows['date']);
echo $nudate[1]."/".$nudate[2];
ASKER
echo date('m/d', $rows['date']);
But it prints out all 12/31 for all records regardless of the actual date being pulled from the db...