1: 2: 3:
$date = '8/31/2009 12:00:00 AM'; $date =~ s/^(\d+)\/(\d+)\/(\d+).*/sprintf("%04d",$3)."-".sprintf("%02d",$1)."-".sprintf("%02d",$2)/e; print "$date\n";