Home >Database >Mysql Tutorial >MySql日期查询语句详解_MySQL

MySql日期查询语句详解_MySQL

WBOY
WBOYOriginal
2016-06-01 13:25:461098browse

bitsCN.com 使用DATE_FORMAT方法
SELECT * FROM `ler_items` WHERE DATE_FORMAT(postTime,'%Y-%m')='2013-03'
注意:日期一定要用'',否则没有效果
其它的一些关于mysql日期查找语句
mysql> select date_format(DATE_SUB(CURDATE(), INTERVAL 7 DAY),'%y%m%d');
+―――――――――――――――――――

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn