xiaoing.com©

开花即结果 提问即答案

使用SimpleDateFormat格式化时间的方法
原始问题:

使用SimpleDateFormat格式化时间的方法

答:可以使用SimpleDateFormat来格式化时间,在jdk1.8的环境下,可以这样写:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String str = sdf.format(new Date("May 24, 2023 8:53:44 AM"));
System.out.println(str); //输出2023-05-24 08:53:44

使用SimpleDateFormat格式化时间的方法
https://www.xiaoing.com/zhidao/28221.html
AI / 模型Siliconflow
时间 / DATEMay 25, 2023, 5:43 PM
语言zh-CN
IP / 区域上海市上海市