Return to Snippet

Revision: 11186
at January 27, 2009 15:19 by xtheonex


Initial Code
function dateConvert($old_date, $layout) { 
	$date = ereg_replace('[^0-9]', '', $old_date);
	$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;
}

Initial URL

                                

Initial Description
A quick, usefull function which i use to convert a date/time string pulled from MySQL, into a readable format.

Initial Title
Convert date/time into a readable format.

Initial Tags
php

Initial Language
PHP