bitsCN.com
mysql日期比较语句 select * from student where '2012-02-27 00:00:00' created_date select * from student where UNIX_TIMESTAMP('2012-02-27 00:00:00') UNIX_TIMESTAMP(created_date); SELECT * FROM student WHERE (UNIX_TIMESTAMP(created_date) - UNIX_TIMESTAMP('2012-02-26 00:00:00') ) >= 0 AND (UNIX_TIMESTAMP(created_date) - UNIX_TIMESTAMP('2012-02-29 00:00:00') )
有了这个函数,就可以很自然地把时间比较转换为一个无符号整数的比较。例如,判断一个时间是否在一个区间内unix_timestamp( time ) between unix_timestamp( 'start ') and unix_timestamp( 'end' ) bitsCN.com