php mysql从月开始选择4周

时间:2012-05-09 16:46:51

标签: php mysql

我需要从一个月开始选择所有4周。我有如何获得工作日:

SELECT impression_ip, WEEKDAY(FROM_UNIXTIME(impression_time)) FROM impressions WHERE impression_time BETWEEN start_timestamp AND end_timestamp

idk mysql函数,但如果你找到我的话应该像MONTHWEEK

PHP fragment here

1 个答案:

答案 0 :(得分:0)

可以在执行SQL语句之前实现解决方案。

鉴于今天的日期 - 2012-05-09

$currentDate = date("Y-m-d");// Take the current date
//Add four weeks
$plusFourWeeks = strtotime($currentDate . " +4 weeks ");

echo $plusFourWeeks;

日期添加四周后:2012-06-06

                            For your convenience -
                          or if you just don't trust me ;)