在mysql数据库中,我的时间存储varchar类型,这样就不需要转换,直接time<'2015-4-1'或者time>'2015-4-1'就OK。如果是date类型就通过to_days()转换。直接date between time1 and time2.