Link to home
Start Free TrialLog in
Avatar of edavo
edavoFlag for United States of America

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
Avatar of edavo
edavo
Flag of United States of America image

ASKER

Someone had suggest this:

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...
ASKER CERTIFIED SOLUTION
Avatar of Kerem ERSOY
Kerem ERSOY

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try this.  http://us.php.net/manual/en/function.explode.php
$nudate = explode("-", $rows['date']);
echo $nudate[1]."/".$nudate[2];

Open in new window