2014-11-21 97 views
-2

我試圖建立我的議程在PHP中,使用strtotime返回日期基於什麼想要的用戶,但我觀察一個理解的問題whith strtotime!本月的第一天

當我說Fisrt 2014年9月的星期一,它給了我9月8日。 normaly它應該返回9月1日!

您認爲如何?

<?php 
$j = strtotime("First Monday Septembre 2014"); 
echo date('d F',$j); 
?> 

<?php 
$j = strtotime("First Monday July 2013"); 
echo date('d F',$j); 
?> 

同樣的問題,否則,當這一天是不是在每月第一個它給你天權

+0

可能重複的[利用日期在PHP當前月份的第一天\ _modify作爲DateTime對象(http://stackoverflow.com/questions/2094797/the-first-day-of -the-current-month-in-php-using-date-modify-as-datetime-object) – RichardBernards 2014-11-21 10:52:14

+0

可能的重複http://stackoverflow.com/questions/7724954/php-strtotime-first-monday-february-returns-第二 - 星期一 - 如果二月一日 - 是 – Mrlitty 2014-11-21 10:53:46

回答

0

$ J =的strtotime(「2014年9月的第一個星期一「); echo date('d F',$ j);

上面的代碼將返回結果爲「9月1日」。

試試吧,讓我知道你是否面對任何錯誤。

最佳運氣

+0

是的「的」是我的問題的來源,非常感謝你 – 2014-11-21 12:25:27