12 ) $mies = 1; $date .= "-" . $mies; } if (ereg("^[0-9]{1,2}([.-])([0-9]{1,2})$", $date, $regs)) { # uzupelniamy rok $rok = date ("Y"); if ( $regs[2] < date("m") ) $rok++; $date .= $regs[1] . $rok; } if (ereg("^[0-9]{4}[.-][0-9]{1,2}[.-][0-9]{1,2}$", $date)) { $tab = explode(substr($date, 4, 1), $date); if (!checkdate($tab[1], $tab[2], $tab[0])) return false; else return mktime(0, 0, 0, $tab[1], $tab[2], $tab[0]); } else if (ereg("^[0-9]{1,2}[.-][0-9]{1,2}[.-][0-9]{4}$", $date)) { $tab = explode(substr($date, strlen($date)-5, 1), $date); if (!checkdate($tab[1], $tab[0], $tab[2])) return false; else return mktime(0, 0, 0, $tab[1], $tab[0], $tab[2]); } else if (ereg("^[0-9]{8}$", $date)) { $y = substr($date, 0, 4); $m = substr($date, 4, 2); $d = substr($date, 6, 2); if (!checkdate($m, $d, $y)) return false; else return mktime(0, 0, 0, $m, $d, $y); } else return false; } ?>