John wrote:
hello all

Hello,

i am wondering a there is a module that do comparisons
between two different datetime stamps

for example

2/4/2005:15:20:20 and 4/4/2005:12:09:23

which date is bigger (namely earliest)

Probably the easiest way is to convert them to comparable strings:

my ( $date1, $date2 ) = ( '2/4/2005:15:20:20', '4/4/2005:12:09:23' );

# I assume the date is m/d/y:h:m:s?

my $cmp1 = sprintf '%04d%02d%02d%02d%02d%02d', ( $date1 =~ /\d+/g )[ 2,0,1,3,4,5 ];
my $cmp2 = sprintf '%04d%02d%02d%02d%02d%02d', ( $date2 =~ /\d+/g )[ 2,0,1,3,4,5 ];


if ( $cmp1 gt $cmp2 ) {
    do_something();
    }



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to