记录一个注意点:SimpleDateFormat转化问题

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formatdate = simpleDateFormat.format(new Date());
//formatdate就是当前时间

注意:一定要用"yyyy-MM-dd",不能是"yyyy-MM-DD"或"yyyy-mm-dd"。

posted @ 2022-10-31 20:00  w中中w  阅读(21)  评论(0)    收藏  举报