Home > Database > Mysql Tutorial > Mysql的timestamp的查询_MySQL

Mysql的timestamp的查询_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:30:18
Original
1229 people have browsed it

bitsCN.com

Mysql的timestamp的查询

 

在mysql , 凡是以timestamp为类型的字段作为查询条件的都要做转换,如下:

 

DATE_FORMAT(`timestamp`,'%Y-%m-%d %H:%i:%s')>='2013-03-05 00:00:00' 
Copy after login

我原来是这样处理:

DATE(`timestamp`)>='2013-03-05 00:00:00' 
Copy after login

结果发现,只列出03-06的数据出来,03-05有数据,但没显示,后来换成这样才行,

DATE_FORMAT(`timestamp`,'%Y-%m-%d %H:%i:%s') 
Copy after login

 

 

各位,以后遇到这样的情况,注意一下

 

bitsCN.com
Related labels:
Statement of this Website
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
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template