note 18796 deleted from function.ereg by sander
| From: | sander@php.net | Date: | Sun, 12 May 2002 15:53:27 +0000 |
| Subject: | note 18796 deleted from function.ereg by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30541@lists.php.net to get a copy of this message | ||
Here a example using regular expresions:
function us2esdate( $date)
{
ereg("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})$", $date, $c);
$year = &$c[1];
$month = &$c[2];
$day = &$c[3];
return "$day-$month-$year";
}
function es2usdate( $date)
{
ereg("^([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})$", $date, $c);
$year = &$c[3];
$month = &$c[2];
$day = &$c[1];
return "$year-$month-$day";
}
PHP is great, marco no curres tanto..