Your code worked fine for me... this:
<?php
$date = "2004-02-07";
if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $regs)) {
echo "$regs[3].$regs[2].$regs[1]";
} else {
echo "Invalid date format: $date";
}
?>
outputted this:
07.02.2004
EDIT: As a side note, you could convert this to use the [man]PCRE[/man] functions quite easily:
if (preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $date, $regs)) {
Also note that if you're getting the dates from a database (e.g. MySQL), then it would be simpler (and more efficient, I'd think) to use MySQL's built-in function DATE_FORMAT().