首页 > 其他分享 >时间类型和字符串类型相互转换——SimpleDateFormat中parse和format的用法

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

时间:2022-10-09 14:22:06浏览次数:80  
标签:format SimpleDateFormat parse 字符串 new simpleDateFormat

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")

标签:format,SimpleDateFormat,parse,字符串,new,simpleDateFormat
From: https://www.cnblogs.com/gsxm/p/16771960.html

相关文章