
@toc
这段代码用于在Java中将一个时间戳(毫秒数)转换为“年-月-日 时:分:秒”格式的日期时间字符串,常用于日志解析、数据调试或时间字段格式化展示。
@Test
public void millisecondsToDate() throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(simpleDateFormat.format(new Date(1639381826)));
}原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。