How to calculate date difference in perl
date, datetime, perl
Solution
Time::Piece has been a standard part of Perl since 2007.
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
use Time::Piece;
my $date1 = 'Fri Aug 30 10:53:38 2013';
my $date2 = 'Fri Aug 30 02:12:25 2013';
my $format = '%a %b %d %H:%M:%S %Y';
my $diff = Time::Piece->strptime($date1, $format)
- Time::Piece->strptime($date2, $format);
say $diff;
Problem
I am a novice in perl scripting. I have a requirement where in I need to find the difference of two dates in the minutes/seconds ``` $date1 = Fri Aug 30 10:53:38 2013 $date2 = Fri Aug 30 02:12:25 2013 ``` can you tell me how do we achieve this, Parsing , calculation , modules req and all Thanks Goutham