如何在php中查找每月最后一个星期四的日期?

如何在php中查找每月最后一个星期四的日期?,php,date,Php,Date,如何在php中查找每月最后一个星期四的日期 这是为了付款。员工需要在提交发票当月的最后一个星期四付款。我很难找出本月最后一个星期四的日期 谢谢 阿比纳布 找到一个月的第一天 一天一天向后走,直到星期四 PHP>=5.3: <?php $date = strtotime('last thu of this month'); echo date('d.m.Y H:i:s', $date); 我该怎么做第一???我可以找到2号。。对不起,约会的事有点不对劲 <?php $date = s

如何在php中查找每月最后一个星期四的日期

这是为了付款。员工需要在提交发票当月的最后一个星期四付款。我很难找出本月最后一个星期四的日期

谢谢 阿比纳布

  • 找到一个月的第一天
  • 一天一天向后走,直到星期四
  • PHP>=5.3:

    <?php
    $date = strtotime('last thu of this month');
    echo date('d.m.Y H:i:s', $date);
    

    我该怎么做第一???我可以找到2号。。对不起,约会的事有点不对劲
    <?php
    $date = strtotime(sprintf('+1 month %s %s', date('F'), date('Y')));
    while (date('D', $date) !== 'Thu') {
        $date -= 86400;
    }
    
    echo date('d.m.Y H:i:s', $date);
    
    30.06.2011 00:00:00