use Time::Piece; my $str = '2005-03-28 12:00:00'; my $fmt = '%Y-%m-%d %H:%M:%S'; print Time::Piece->strptime($str,$fmt)->epoch; __END__ 1112011200