Hey Chris
If the text field only contains dates, I'd suggest converting it to a DATE type
the use DATE_FORMAT in your SELECT statement to return the format needed. This also
lets MySQL sort it for you,
ie:
SELECT DATE_FORMAT(date, '%b %e %Y') FROM your_table ORDER DESC BY date
Right off hand I don't think there's a simple way to sort it in PHP. If you want
to keep it as a text field then you'll probable have to parce the dates and sort it
accordingly, ie:
foreach ($dates as $date)
$parced_dates[] = split(' ', $date);
// Your own sort functions
sort_by_years($parced_dates);
sort_by_months($parced_dates);
sort_by_days($parced_dates);
I hope this helps
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?
--
Ron Wills
DMS Control Programmer
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]