2014-11-21 101 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