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.
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.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; }
Thanks in advance
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to find Date and Time difference?
by Zaxo (Archbishop) on Jul 08, 2005 at 05:24 UTC | |
Re: How to find Date and Time difference?
by Enlil (Parson) on Jul 08, 2005 at 05:32 UTC | |
Re: How to find Date and Time difference?
by Joost (Canon) on Jul 08, 2005 at 07:50 UTC | |
Re: How to find Date and Time difference?
by davidrw (Prior) on Jul 08, 2005 at 09:44 UTC | |
Re: How to find Date and Time difference?
by leedo (Novice) on Jul 08, 2005 at 19:22 UTC | |
Re: How to find Date and Time difference?
by gube (Parson) on Jul 08, 2005 at 05:29 UTC |