Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

(tye)Re: sorting mm/dd/yy

by tye (Sage)
on Dec 15, 2000 at 04:17 UTC ( [id://46763]=note: print w/replies, xml ) Need Help??


in reply to sorting mm/dd/yy

Convert to the one true date format of yyyy-mm-dd and just use the default sort:

foreach( keys %totals ) { $totals{$_}= "20" . join "-",( split m#/#, delete $totals{$_} )[2,0,1]; }
and thank vroom that the y2k thing finally blew over so you don't have to do that 2-digit-to-4-digit year conversion thing the "proper" way anymore.

update: got the one true date format wrong the first time... i'm so ashamed...

        - tye (and not even my friends are sure when I'm joking)

Replies are listed 'Best First'.
Re: (tye)Re: sorting mm/dd/yy
by 2501 (Pilgrim) on Dec 15, 2000 at 10:13 UTC
    ++'s to tye for stating the answer which should always be considered first:P Why work so hard when the work has already been done for you?

    unix epoch is good too as long as you don't have to do too much date interaction with users. I love using straight time() in my programs because I get everything I could ever want to know in one shot
    If there is ever a chance to switch date formats, YYYYMMDD and unix epoch rank right up there.
Re: (tye)Re: sorting mm/dd/yy
by mirod (Canon) on Dec 15, 2000 at 17:35 UTC

    If that's any help convincing your boss, customer or yourself that this is an acceptable format for date it is an ISO standard, ISO-8601 (pdf) and I found this page to be a very good description of the standard (TIMTOWTFAD - There Is More Than One Way To Format A Date) and why use it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-16 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found