Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Sorting by date

by pzbagel (Chaplain)
on Jan 06, 2004 at 00:54 UTC ( #318988=note: print w/ replies, xml ) Need Help??


in reply to Sorting by date

I would suggest using DateTime.pm if you want to do this with modules. It is very helpful when it comes to figuring out which month/week of the year a given date falls in.

Otherwise, when I want to avoid using a module and I am dealing with simple things like sorting based on date, I convert the date to the YYYYMMDD format. Now the dates can be sorted numerically very quickly.

Later


Comment on Re: Sorting by date
Re: Re: Sorting by date
by Anonymous Monk on Jan 06, 2004 at 11:51 UTC
    Just make sure that YYYY is in 4-digit format and MM or DD in 2-digit format.

    Like in this case: 20040113 (for 2003, Jan. 13) may mean numerically different from 2004113 (this might mean 2004, Jan. 13 or 2004, Nov. 3)

    Had you been using a database like MySQL, that shouldn't have been an issue.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2015-07-02 01:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls