in reply to time format
Hello bigup401,
Fellow Monks have already proposed solutions to your problem. I would like to add also another possible way.
I prefer to use the module Date::Manip regarding Date/Time manipulations/calculations. You can find also here a few basic examples Date::Manip::Examples.
#!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $date1 = ParseDate("now"); my $date2 = ParseDate("2 hours ago"); my $delta = DateCalc($date1, $date2, 1); say $delta; say Delta_Format($delta,"Was %hv hours, %mv minutes, %sv seconds"); __END__ $ perl test.pl 0:0:0:0:-2:0:0 Was -2 hours, 0 minutes, 0 seconds
Hope this helps, BR.
|
|---|