SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String
dateFormat=format.format(date);
select * from test where tdate <= date_format('dateFormat',
'%Y-%m-%d %H:%i:%s')
数据库相应字段tdate可以为datetime,timestamp,也可以为varchar(16);如果为字符串类型,其格式必须为yyyy-MM-dd HH:mm:ss。
MySQL日期比较-SQL方式
猜你喜欢
转载自wywam1128.iteye.com/blog/1965324
今日推荐
周排行