Re: Sorting Dates in this format: Jul 21 2001
| From: | David Robley | Date: | Fri, 10 Aug 2001 03:33:55 +0000 |
| Subject: | Re: Sorting Dates in this format: Jul 21 2001 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62103@lists.php.net to get a copy of this message | ||
On Tue, 7 Aug 2001 19:39, Chris wrote:
> I have a bunch of dates like this:
> Jul 24 2001
> Jul 31 2001
> Aug 7 2001
>
> I need to sort it from oldest to newest, but I can't devise a way that
> works. And they are text fields in MySQL so that won't sort it
> correctly either. Can anyone point me in the right direction?
Two possible ways - one is to use Mysql date functions to create a
sortable field and order your query by that field.
Or convert them to Unix timestamp with PHP using strtotime, then sort and
display using date. The former would be preferable.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Taxes are not levied for the benefit of the taxed.