看板 PHP 關於我們 聯絡資訊
各位好!我遇到一個問題,是關於"找出某年某月總共有幾天"的問題: 若我要查的是2007年2月的話, 我用 $dayCount = date("t",strtotime("2007-02-01")); //本月共有幾天 echo "2月共有" . $dayCount . "天<br>"; 會印出"2月共有28天",這是正確的!!! 但是,如果是用: $stamps = mktime(0,0,0,2,1,2007); $dayCount = date("t", $stapms); //本月共有幾天 echo 2"月共有" . $dayCount . "天<br>"; 則會印出"2月共有31天" 而且不管改成哪個月,會是31天.... 不知道是錯在哪呢?? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.125.80.119
Kej:$dayCount = date("t", $stapms) <-- 是 $stamps 不是 $stapms 03/24 17:35
thekingofsea:啊!!@@ 原來如此!!......... 03/24 17:37
thekingofsea:謝謝您....小小的錯誤...害我想好久= =+ 03/24 17:38