欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java 去掉时间中的T

程序员文章站 2022-06-07 15:14:01
...
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss", Locale.US);

String strLocalDate = "2015-10-23T03:34:40";

LocalDateTime localDate = LocalDateTime.parse(strLocalDate, formatter);

System.out.println(localDate);
System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(localDate));
System.out.println(DateTimeFormatter.ofPattern("HH:mm:ss yyyy-MM-dd ").format(localDate));

打印

2015-10-23T03:34:40
2015-10-23 03:34:40
03:34:40 2015-10-23
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(deliverGoods.getCreateTime())

http://www.voidcn.com/article/p-uecqldgu-bvo.html

相关标签: java java