function isdate($str, $format = "Y-m-d") {
	$strArr = explode ( "-", $str );
	if (empty ( $strArr )) {
		return 0;
	}
	foreach ( $strArr as $val ) {
		if (strlen ( $val ) < 2) {
			$val = "0" . $val;
		}
		$newArr [] = $val;
	}
	$str = implode ( "-", $newArr );
	$unixTime = strtotime ( $str );
	$checkDate = date ( $format, $unixTime );
	if ($checkDate == $str)
		return 1;
	else
		return 0;
}