sorting dates with php

From: Date: Wed, 21 Dec 2005 18:38:05 +0000
Subject: sorting dates with php
Groups: php.general 
Request: Send a blank email to php-general+get-227779@lists.php.net to get a copy of this message
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 22/12/2005 19/12/2005 17/12/2005 12/12/2005 10/12/2005 06/12/2007 06/09/2002 05/12/2005 05/09/2005 Now I have tried to use strtotime() but I find this needs a timezone (GMT) to work and I don't know if the server supports it. Also I find strototime() and mktime() very confusing and a things go wrong of you work in GMT because we also have Brittish Summer Time where the clocks get put back/forward at certain time of the year. Is there a simple function like sort() that could do it?? R.

« previous php.general (#227779) next »