http://www.perlmonks.org?node_id=473325

gube has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I used the below code using Date::Calc. It's working good. But, my requirement is something exactly with date and minute correct also.

use Date::Calc qw(Delta_YMDHMS); ($day1,$month1,$year1,$hour1,$min1,$sec1) = &getMeanTime; ($day2,$month2,$year2,$hour2,$min2,$sec2) = &getMeanTime; ($D_y,$D_m,$D_d, $Dh,$Dm,$Ds) = Delta_YMDHMS($year1,$month1,$day1, $ho +ur1,$min1,$sec1, $year2,$month2,$day2, $hour2,$min2,$sec2); print sprintf("%02d", $D_d).'/'.sprintf("%02d", $D_m).'/'.sprintf("%04 +d", $D_y).' '.sprintf("%02d", $Dh).':'.sprintf("%02d", $Dm).':'.sprin +tf("%02d", $Ds); sub getMeanTime { my $time = time; my ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $D +ayOfYear, $IsDST) = gmtime($time); $Year+=1900; $Month+=1; return $Day,$Month,$Year,$Hour,$Minute,$Second; }
If the difference between the date and time zero means i want the same date and time with seconds. But, It showing all date time to zero.

Thanks in advance