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


in reply to Comparing timestamps that are in 2 different but defined styles

POSIX::strptime look promising. Something like this (untested)

use POSIX::strptime; my $timestamp = "2010-07-23 19:44:43.523"; #remove milliseconds $timestamp =~ s/\.\d+$//; my ($t_sec, $t_min, $t_hour, $t_mday, $t_mon, $t_year, $t_wday, $t_yda +y) = POSIX::strptime($timestamp, "%Y-%m-%d %H:%M:%S"); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); if($t_year == $year && $t_mon == $mon && $t_mday == $mday && $t_hour == $hour && abs($t_min-$min) <= 1){ #dates match }