摘要:
转自:http://www.myexception.cn/mysql/485349.htmlMySQL时间函数的使用:查询本周、上周、本月、上个月份的数据【转】/*今天*/select * from 表名 where to_days(时间字段) = to_days(now());/*昨天*/select * from 表名 where to_days(now())-to_days(时间字段) = 1;/*近7天*/select * from 表名 where date_sub(curdate(), interval 7 day) <= date(时间字段);/*查询距离当前现在6个月的数 阅读全文
摘要:
转自:http://www.the8m.com/blog/article/phpa/phpwek.html注意强大的strtotime()函数和mktime()函数。 <?php echo date("Ymd",strtotime("now")), "\n"; echo date("Ymd",strtotime("-1 week Monday")), "\n"; echo date("Ymd",strtotime("-1 week Sund 阅读全文