我有以下功能,只从当前的月份拉评论。我需要它不会从下个月收到任何评论。PHP增加1个月,但考虑到年度变化
我有下个月定义为$to_date
与+1
我怎么能改变这个自动计算出它在下一年,即防止它在第13个月?谢谢
Function to only pull comments from a date range of the current month
$from_date = date('Y-m') . '1 00:00:00';
$to_date = date('m') . '1 00:00:00'+1;
$all_comments = Comment::find('all',
array(
'conditions'=>array('response_date_and_time >= ? AND response_date_and_time <= ?', $from_date, $to_date)
)
);
使用mysql日期函数此 – 2013-01-23 03:32:22