use DateTime::Format::DBI; use DateTime::Format::MySQL; use DBI; my $access_date="Sun Jun 15 22:59:50 CEST 2014"; my ($day, $month, $date, $H, $M, $S, $tz, $yr) =split /[)(;:,\s\/]+/, $access_date; my $myDate="$yr"."-"."$month"."-"."$date"."-"."$H".":"."$M".":"."$S"; print $myDate; # Parse string into a DateTime object DateTime::Format::MySQL->format_datetime($myDate), my $db_parser = DateTime::Format::DBI->new($dbh);