Re: Sorting a text string
| From: | Alan Morey | Date: | Thu, 05 Sep 2002 13:59:39 +0000 |
| Subject: | Re: Sorting a text string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115307@lists.php.net to get a copy of this message | ||
$date = '04.09.2002';
$date = preg_replace('/(\d{2}).(\d{2}).(\d{4})/', '\\3.\\2.\\1', $date);
echo $date;
Output:
2002.09.04
Read up for more info.
http://www.php.net/manual/en/ref.pcre.php
regards
alan
Bård tommy nilsen wrote:
I want to sort text strings, but how could i do this ? Example: 04.09.2002 05.09.2002 19.03.1999 Is there a way to "change" the string to something like this ... 2002.09.04 2002.09.05 1999.03.19 Or is there a better way to solve this ?? Bård Tommy Nilsen