note 54405 added to function.date

From: Date: Sun, 03 Jul 2005 12:25:04 +0000
Subject: note 54405 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-91348@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54405 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54405&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54405&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54405&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54405&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54405&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54405&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54405&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#91348) next »