나는 날짜를 comapre에 약간의 코드를 쓴다. 문제는 내가 2012/mar/23으로 출력 할 때 약간의 시간을 정정하고, 어떤 때는 wrong.when으로 날짜를 입력 할 때이다./23 출력을 제공 할 때도 있습니다. 때때로 문제가 생깁니다.이 문제를 해결할 수 있습니까?날짜 비교
<?php
$month = 2;
$year = 2012;
$saturday = strtotime('First Saturday '.date('F o', mktime(0,0,0, $month, 1, $year)));
echo date('Y/M/d', $saturday);
$sat1 = strtotime($saturday);
echo "<br/>";
$season1 = strtotime ('+12 week' , $saturday);
$season2= date ('Y/M/d' , $season1);
echo $season2;
$season = strtotime($season1);
echo "<br/>";
$date = $_POST["date"];
echo $date;
$date1 = strtotime($date);
echo "<br/>";
$abc = strtotime ('+1 week' , $season1);
$abc = date ('Y/M/d', $abc);
echo "<br/>";
echo $abc;
$abc1 = strtotime($abc);
if ($date1 <= $abc1)
{
if ($date1 <= $season)
{
echo "League already opened";
}
else if($date1 > $season)
{
echo "league successfully closed";
}
}
else
{
echo "league 1 closed";
}
if(!isset($POST['submit'])) {
?>
<form method="post" action=" ">
<label>enter date in YYYY/MM/DD format</label>
<input type="text" name="date" size="10" />
<input type="submit" value="submit" name="submit">
</form>
<?
}
?>
출력에 그 condition.before가 strtotime으로는 "Y/M/D"이것은 단지 지원
를 지원하지 않는
코드를 들여 쓰기해야합니다! – ThiefMaster
누구든지 위의 코드에 대한 해결책을 말할 수 있습니까? .thanks in advance – leela