记录一些常用的mysql日期函数
1、查询当天数据
sql = 'select * from article where add_time = CURDATE()'
2、查询昨天数据
sql = 'select * from article where to_days(now()) - to_days(add_time) = 1'
3、查询指定周的数据
$week_index = date("W")
sql = "select * from article where WEEKOFYEAR(add_time) = $week_index"
4、查询指定月的数据
$month_index = date('m')
sql = "select * from article where MONTH(add_time) = $month_index"
课程余量有限,即将截止报名!查看详情