> Hi there,
>
> I've got a date field and a time field, how can I effectively subtract the
> field ($date $time) - ($date2 $time2) from each other. I am using these
> two fields to determine a server's uptime according to my database in
> days,hours,minutes,seconds.
> Kind Regards,
> Werner Otto

Perhaps this is want you are looking for   :-)

#!/usr/bin/perl
use strict;
use warnings;
use Date::Calc qw / Delta_DHMS /;

my $date1 = "2004-02-20 12:10:30";
my $date2 = "2004-10-30 12:40:22";

print join " ", Delta_DHMS(split /[-\s:]/, "$date1 $date2");

*** Output
253 0 29 52

Chris



-- 
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