public static void main(String[] args) throws ParseException {
Date date = new Date();
System.out.println(date);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
System.out.println(dateString);
Date date2 = formatter.parse(dateString);
System.out.println(date2);
}
java时间格式转字符串,字符串格式转时间格式
最新推荐文章于 2024-08-29 03:47:37 发布