Convert date from YYYYMMDD to DD/MM/YYYY format in PHP
In your SQL statement you can format the date differently.
SELECT DATE_FORMAT(date_column, '%d/%m/%Y') AS my_date FROM my_table
You can easily use the DateTime class to do this
$retrieved = '20121226';
$date = DateTime::createFromFormat('Ymd', $retrieved);
echo $date->format('d/m/Y');
http://php.net/manual/en/datetime.format.php
This is the solution :
SELECT DATE_FORMAT('20121226', '%d/%m/%Y');
=>
DATE_FORMAT('20121226', '%d/%m/%Y')
26/12/2012
OR
SELECT DATE_FORMAT('20121226', '%W %M %Y');
=>
DATE_FORMAT('20121226', '%W %M %Y')
Wednesday December 2012
Check this for more formatting: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format