Convert date/time into a readable format.
A quick, usefull function which i use to convert a date/time string pulled from MySQL, into a readable format.
Copy this code and paste it in your HTML
function dateConvert($old_date, $layout) {
$date_year = substr($old_date,0,4); $date_month = substr($old_date,5,2); $date_day = substr($old_date,8,2); $date_hour = substr($old_date,11,2); $date_minute = substr($old_date,14,2); $date_second = substr($old_date,17,2); $new_date = date($layout, mktime($date_hour, $date_minute, $date_second, $date_month, $date_day, $date_year)); return $new_date;
}
Report this snippet
Comments
Subscribe to comments