in reply to Find minutes difference between two dates
It's impossible to know the different in minutes without knowing the timezone of the times.
I use DateTime
#!/usr/bin/perl use strict; use warnings; use DateTime qw( ); use DateTime::Format::Strptime qw( ); my $format = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d %H:%M:%S', ); my $start = $format->parse_datetime( '2007-12-31 16:50:00' ); my $stop = $format->parse_datetime( '2008-1-1 04:24:00' ); $_->set_time_zone('local') for $start, $stop; print( $start->delta_ms($stop)->in_units('minutes'), "\n" ); # 694
|
|---|