DB中的日期格式与输出不同

I'm looking to echo the date from a mysql table on a page, though it is not doing it in the format I would like. In the table the format is as follows : "06-Feb-2015" which is ideal....

Though when I grab that from the table (this is used in php):

 SELECT DISTINCT `Expiry` FROM `QA_Data`

and:

 $row = $sql->fetch();
 echo $row['Expiry'];

it echo's it out as "2015-02-06"

I''m sure this can be approached from the php or the mysql side but I would prefer the php answer if possible!

Thanks a million

You can read PHP Manual.

$date = "2015-02-06";
echo date("d-M-Y",strtotime($date));  

Output

06-Feb-2015

you can use date and strtotime functions Date Functions

$date = $row['Expiry'];
echo date("d-M-Y",strtotime($date));

Yon can convert the date to a string in mySQL:

SELECT DISTINCT DATE_FORMAT(`Expiry` , '%d-%b-%Y') AS Expiry;

and:

$row = $sql->fetch();
echo $row['Expiry'];

From: date_format function manual

But if you prefer php side:

$row = $sql->fetch();
echo date("d-M-Y", strtotime($row['Expiry']));