[PHP] sorting dates with php

2005-12-21 Thread Ross
Hi, Have a load of dates in the format DD/MM/YY. Thet are stored as a VARCHAR on a mysql DB. I need a way to sort them into order(most recent first) Using the QUERY $query = SELECT doc_date FROM papers ORDER BY doc_date DESC; this just arranges them by day. e.g 30/12/2005 30/11/2005

Re: [PHP] sorting dates with php

2005-12-21 Thread André Medeiros
You COULD sort them if the date was stored backwards, ie. Year/Month/Day On 12/21/05, Jim Moseby [EMAIL PROTECTED] wrote: Have a load of dates in the format DD/MM/YY. Thet are stored as a VARCHAR on a mysql DB. I need a way to sort them into order(most recent first) Using the

Re: [PHP] sorting dates with php

2005-12-21 Thread Chris Lott
On 12/21/05, Ross [EMAIL PROTECTED] wrote: Hi, Have a load of dates in the format DD/MM/YY. Thet are stored as a VARCHAR on a mysql DB. Couldn't you use cast() to cast the values first? Something like (untested): SELECT CAST(doc_date AS DATE) FROM papers ORDER BY doc_date DESC c -- PHP