note 11717 deleted from function.str-pad by felipe
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
Note Submitter: rob at OhReally dot com
----
To reformat the date "3-3-2001" to "2001-03-03" you would use this regexp:
$newdate = preg_replace("/([0-9]+)-([0-9]+)-([0-9]+)/ie", "'\\3-'.str_pad('\\2', 2, '0', STR_PAD_LEFT).'-'.str_pad('\\1', 2, '0', STR_PAD_LEFT)", $date);