[Israel.pm] Sorting By MySQL DATETIME Fields?
Gaal Yahas
gaal at forum2.org
Wed Jun 16 02:51:19 PDT 2004
On Wed, Jun 16, 2004 at 12:34:18PM +0300, I wrote:
> > Is there a module or hack to do this?
>
> Can't you just sort the array?
>
> @sorted = sort { $a->{datefield} <=> $b->{datefield} } @unsorted;
Ah, use cmp instead of <=> since your column is DATETIME (if it were
TIMESTAMP <=> would be better).
--
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/
More information about the Perl
mailing list