Wijaya Edward wrote:
Hi,
Suppose I have this two strings:
my $beginning = 'Fri Oct 25 17:37:58 2007';
my $end       = 'Fri Oct 26 06:54:09 2007';
How can I compute the time difference between
them (in secs)? Is there any CPAN module that does that?
I have a large text files which contain two columns (begin + end)
which I need to find the time difference between them

Date::Manip will do what you need. I've removed the 'Fri' from the start
of your dates as only one of them is a Friday; but if your actual data
is correct in this regard then the format will be fine as it is.

HTH,

Rob


use strict;
use warnings;

use Date::Manip;

my $beginning = 'Oct 25 17:37:58 2007';
my $end       = 'Oct 26 06:54:09 2007';

my $diff = DateCalc($beginning, $end);
print $diff, "\n";
print Delta_Format($diff, 0, '%sh seconds'), "\n";


**OUTPUT**

+0:0:0:0:13:16:11
47771 seconds

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


Reply via email to