Ask a Question related to PERL Miscellaneous, Design and Development.
-
Sam #1
date sorting module
Hello
I just came from cpan, after doing some searches and before I get a module,
wanted to ask if any one out there knows of a module that takes an array of
dates and sort them regardless of the date formate.
thanks
Sam Guest
-
Sorting a date column
Sekhar, I think you have run across a known bug where the order by ignores the table prefix POProjects. and orders by the result column called... -
Sorting Hash of Hashes with HEAP module
Hi, I would like to use the Heap module from CPAN to sort Hash of Hashes by values, keeping track of what pairs of keys belong to what values. ... -
Formatting and sorting date
I have an asp page which displays records from an access table. One of the fields in the table is a date field. The regional settings on the... -
Grouping and sorting by date
If you convert your date without the time in datetime format, sql will take it and put 00:00:00 as the time everywhere. That will make grouping... -
Module for sorting (while either reading from or writing to) a FH?
Michele Dondi <bik.mido@tiscalinet.it> wrote: You might borrow code from the Perl Power Tool's implementation of sort(1): ... -
Andreas Kahari #2
Re: date sorting module
In article <3f66c9a3$1@news.comindico.com.au>, Sam wrote:
If the dates doesn't follow any pattern, how could you sort it?> Hello
> I just came from cpan, after doing some searches and before I get a module,
> wanted to ask if any one out there knows of a module that takes an array of
> dates and sort them regardless of the date formate.
Compare for example the US date format with som eof the European
ones: Does one sort 9/7/2002 before or after 7/10/2002 if one
doesn't know what format they are on?
--
Andreas Kähäri
Andreas Kahari Guest
-
Tad McClellan #3
Re: date sorting module
Sam <samj@austarmetro.com.au> wrote:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^> I just came from cpan, after doing some searches and before I get a module,
> wanted to ask if any one out there knows of a module that takes an array of
> dates and sort them regardless of the date formate.
You can't.
How can you distinguish between these two formats for instance:
09-07-2003 # MM-DD-YYY - September 7
and
09-07-2003 # DD-MM-YYY - July 9
??
--
Tad McClellan SGML consulting
[email]tadmc@augustmail.com[/email] Perl programming
Fort Worth, Texas
Tad McClellan Guest
-
Mothra #4
Re: date sorting module
Hi Sam,
"Sam" <samj@austarmetro.com.au> wrote in message
news:3f66c9a3$1@news.comindico.com.au...module,> Hello
> I just came from cpan, after doing some searches and before I get aof> wanted to ask if any one out there knows of a module that takes an arrayThis might give you some ideas> dates and sort them regardless of the date formate.
use strict;
use warnings;
use DateTime;
my @new_dates;
my @dates =("Sat, 19 Jul 2003 15:53:45 -0500","1996-02-03","08-Feb-1998
14:15:29 GMT");
foreach my $new_date (@dates) {
push(@new_dates, DateTime::Format::Mytest->parse_datetime($new_date) );
}
print map {$_->datetime(), "\n"} sort @new_dates;
package DateTime::Format::Mytest;
use DateTime::Format::HTTP;
use DateTime::Format::Mail;
use DateTime::Format::Builder (
parsers => { parse_datetime => [
sub { eval { DateTime::Format::HTTP->parse_datetime( $_[1] ) } },
sub { eval { DateTime::Format::Mail->parse_datetime( $_[1] ) } },
] }
);
Mothra Guest



Reply With Quote

