Re: Sorting Dates in this format: Jul 21 2001
| From: | David Robley | Date: | Fri, 10 Aug 2001 04:47:19 +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-62109@lists.php.net to get a copy of this message | ||
On Fri, 10 Aug 2001 13:20, Maxim Maletsky wrote:
> and the third option is:
>
> strtotime()
>
> read on about this magic function - will become your life(ass)-saver.
> www.php.net/strtotime
>
>
> Sincerely,
>
> Maxim Maletsky
> Founder, Chief Developer
> PHPBeginner.com (Where PHP Begins)
> maxim@phpbeginner.com
> www.phpbeginner.com
>
>
>
> -----Original Message-----
> From: David Robley [mailto:huntsman@www.nisu.flinders.edu.au]
> Sent: Friday, August 10, 2001 12:34 PM
> To: Chris; PHP (E-mail)
> Subject: Re: [PHP] Sorting Dates in this format: Jul 21 2001
>
> 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.
Isn't that what I said? Or did I misunderstand myself :-)
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Waiter, there's no fly in my soup! - Kermit