import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class Test {
public static void main(String[] args) {
// yyyy-MM-dd HH:mm:ss.SSSSSS
// yyyy-MM-dd HH:mm:ss
// yyyy-MM-dd HH:mm
System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS").format(LocalDateTime.now()));
}
// print 2022-08-04 14:44:32.038000
java 格式化时间字符串
最新推荐文章于 2024-05-14 05:17:50 发布