Gossamer Forum
Home : General : Perl Programming :

Re: [Paul] Need help sorting by date.

Quote Reply
Re: [Paul] Need help sorting by date. In reply to
I'm not sure I understand what you mean... I think what I need is a date to unix function like what Links has. I was able to make Links sort by date using that function because it converts the dd-mmm-yyyy format to unix time. It seems like I could change this:

Code:
foreach $rp (sort { chr($a->{$sort_on} + 97) cmp chr($b->{$sort_on} + 97) } values %record){


to

Code:


foreach $rp (sort { &date_to_unix($a->{$sort_on}) <=> &date_to_unix($b->{$sort_on}) } values %record){


As long as I had a "date_to_unix" function that converts mm/dd/yyyy to unix time, it seems like that would work. The date to unix function in Links converts dd-mmm-yyyy. Can anyone help with this?

Last edited by:

Ryan: Feb 18, 2003, 10:02 AM
Subject Author Views Date
Thread Need help sorting by date. Ryan 4041 Feb 18, 2003, 1:00 AM
Thread Re: [Ryan] Need help sorting by date.
Paul 3895 Feb 18, 2003, 1:21 AM
Thread Re: [Paul] Need help sorting by date.
Ryan 3883 Feb 18, 2003, 10:01 AM
Post Re: [Ryan] Need help sorting by date.
Paul 3882 Feb 18, 2003, 10:31 AM