use Time::Local; # get date and time my ($date, $time) = (split /\|/)[4, 5]; # get dmy my ($d,$m,$y) = split /\//, $date; # get hours & mins my ($hr, $min) = split /:/, $time; # convert year and month into 'correct' forms $y -= 1900; --$m; # get epoch (use 0 for seconds) my $epoch = timelocal(0, $min, $hr, $d, $m, $y); #### use POSIX 'strftime'; my $fmt_date = strftime('%Y-%m-%d', localtime($epoch));