在mysql数据库中关于日期时间字段的处理 在开发中,日期时间字段一般有如下几种设计 假设要获取2013-08-15日到2013-08-16日之间的记录 1. 直接使用日期时间类字段 相关sql语句如下 select * from cms_news where news_add_time between str_to_date("2013-08-15 00:00:00",'%Y-%m-%d %H:%i:%s') and str_to_date("2013-08-16 23:5…
错误的写法: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //这里的格式也可以是别的 createAt =format.parse(y.getCreatedAt()); //此处是接收到的 2019-09-27T18:31:31+08:00 正确的写法: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH…