note 54405 deleted from function.date by aidan

From: Date: Sun, 31 Jul 2005 12:32:21 +0000
Subject: note 54405 deleted from function.date by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-92814@lists.php.net to get a copy of this message
Note Submitter: a_aaminah at yahoo dot co dot uk ---- This is the function i use to make dates more user-friendly: <? function DateConvert($old_date, $layout) { //Remove non-numeric characters that might exist (e.g. hyphens and colons) $date = ereg_replace('[^0-9]', '', $old_date); //Extract the different elements that make up the date and time $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); //Combine the date function with mktime to produce a user-friendly date & time $new_date = date($layout, mktime($date_hour, $date_minute, $date_second, $date_month, $date_day, $date_year)); return $new_date; } ?> More details can be found @ http://phpshortcuts.blog-city.com/dateconvert.htm.

« previous php.notes (#92814) next »