Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

(Date::Manip) Re: sorting mm/dd/yy

by mwp (Hermit)
on Dec 15, 2000 at 04:10 UTC ( [id://46761]=note: print w/replies, xml ) Need Help??


in reply to sorting mm/dd/yy

A quick search of the Date::Manip perldoc yields this:
use Date::Manip qw(ParseDate Date_Cmp); sub sortDate { my($date1, $date2); $date1 = &ParseDate($a); $date2 = &ParseDate($b); return (&Date_Cmp($date1,$date2)); } my @dates = ("Fri 16 Aug 96", "Mon 19 Aug 96", "Thu 15 Aug 96"); my @i = sort &sortDate @dates;
(edited somewhat for clarity)

You could also write this as:

my @i = sort { &Date_Cmp(&ParseDate($a),&ParseDate($b)) } @dates;

Replies are listed 'Best First'.
Re: (Date::Manip) Re: sorting mm/dd/yy
by merlyn (Sage) on Dec 15, 2000 at 04:13 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://46761]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2024-03-28 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found