[PHP-users 34031] strtotimeの値が期待値と違う

martin martin.info.jp @ gmail.com
2008年 9月 1日 (月) 23:23:06 JST


はじめまして、青木と申します。
Apache/2.2.6 (Win32) + PHP 5.2.5
の環境にて、
$today = mktime(0, 0, 0, 9, 1, 2008);
echo date('Y-m-d', $today)."<br/>\n"; // 2008年09月01日 expected
echo date('Y-m-d', strtotime("first Monday", $today))."<br/>\n"; //
2008年09月01日 expected
echo date('Y-m-d', strtotime("+1 Monday", $today))."<br/>\n"; //
2008年09月01日 expected
echo date('Y-m-d', strtotime("last Monday", $today))."<br/>\n"; //
2008年09月29日 expected
echo date('Y-m-d', strtotime("+4 Monday", $today))."<br/>\n"; //
2008年09月29日 expected
を実行すると、
2008年09月01日
2008年09月08日
2008年09月08日
2008年08月25日
2008年09月29日
と出力されます。期待するのは、
2008年09月01日
2008年09月01日
2008年09月01日
2008年09月29日
2008年09月29日
なのですが、どこが悪いのかご指摘あればよろしくお願いします。
尚、Apache/2.0.52 (Red Hat) + PHP 5.1.6 でも同様の結果でした。


PHP-users メーリングリストの案内

AltStyle によって変換されたページ (->オリジナル) /