我已经搜查,搜查,但似乎无法找到任何东西,将适合什么,我试图做的,我似乎无法弄清楚如何使它工作的第三个星期一。计算一个月
以下是查看: 我的电脑俱乐部在每月的第三个星期一开会,一周后俱乐部董事会开会。在我们的俱乐部网站,他们每月都在手动更改此日期... :(
我想用PHP来自动执行它。我有一点点运气,但在大多数情况下它不会出来的权利。
这里是我使用的代码示例:我加了$ thirdtue变量,因为在$ thirdmon变量检查在实际会议日期引起一个问题,它跳跃到未来几个月
//Set Default Time Zone
date_default_timezone_set('America/New_York');
//Define Variables Needed
$now = date("U");
$currmonth = date("n");
$curryear = date("Y");
$monthyear = date("F Y");
$thirdmon = date('U', strtotime($monthyear.' third monday'));
$thirdtue = date('U', strtotime($monthyear.' third tuesday'));
//Check for current date before or after third monday of the current meeting month
if ($now > $thirdtue) {
$monthyear = date("F Y", strtotime('next month'));
$thirdmon = date('U', strtotime($monthyear.' third monday'));
}
echo date("l F d, Y", $thirdmon);
会议日期,所以我检查第三个周二,它不会跳到现在会议日期的午夜。
现在奇怪的是,我是在做这个2014年3月30日,它被显示2014年4月21日,因为这是正确的下次会议的日期。当时间到了午夜,00:00和更改为2014年3月31日的日期,会议日期更改为2014年5月19日!?!?!
我也有一对夫妇是做一些其他计算的代码的其他部分的问题,但我想如果我能得到这个下来,然后我应该能够制定出休息。
谁能告诉我在哪里,我度过了这个轨道?
点击这里【点击链接](http://stackoverflow.com/questions/3985637/third-thursday-of-the-month-in-php) – Himanshu