note 20229 added to function.substr
| From: | joe at dirte dot com | Date: | Wed, 27 Mar 2002 01:34:36 +0000 |
| Subject: | note 20229 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28257@lists.php.net to get a copy of this message | ||
the guy above with the date parser apperantly knows little aout substr.
the correction is:
$date = "1998-07-16";
$year = substr($date, 0, 4);
$month = substr($date, 5, 2);
$day = substr($date, 8, 2);
$newdate = "$day-$month-$year";
echo $newdate;
instead of putting the length of the chars to be substrined he put their location.
--
http://www.php.net/manual/en/function.substr.php
http://master.php.net/manage/user-notes.php?action=edit+20229
http://master.php.net/manage/user-notes.php?action=delete+20229
http://master.php.net/manage/user-notes.php?action=reject+20229