RE: [PHP] Sorting Dates in this format: Jul 21 2001
| From: | Maxim Maletsky | Date: | Fri, 10 Aug 2001 03:50:32 +0000 |
| Subject: | RE: [PHP] Sorting Dates in this format: Jul 21 2001 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-62105@lists.php.net to get a copy of this message | ||
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.
--
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net