- preg_match: documentation ( source)
- gmmktime: documentation ( source)
- gmdate: documentation ( source)
<?php
$date = "20.08.2015";
if (preg_match("!^\d+$!", $date)) {
$time = gmmktime(0, 0, 0, 1, 1, 1900) + ($date - 2) * 24 * 60 * 60;
return gmdate("Y-m-d", $time);
}