[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 メーリングリストの案内