时间类型和字符串类型相互转换——SimpleDateFormat中parse和format的用法

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
simpleDateFormat.parse("xxxxxxx");//字符串->时间
simpleDateFormat.format(new Date());//时间->字符串

转换成什么格式,取决于:new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")

posted @ 2022-10-09 14:13  ICE-CREAMMM  阅读(44)  评论(0编辑  收藏  举报