private static final DateTimeFormatter FORMAT_FOURTEEN = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); private static final DateTimeFormatter FORMAT_DATE = DateTimeFormatter.ofPattern("yyyyMMdd"); private static final DateTimeFormatter FORMAT_NINETEEN = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); public static void main(String[] args) { System.out.println(FORMAT_FOURTEEN.format(LocalDateTime.now())); System.out.println(FORMAT_DATE.format(LocalDateTime.now())); System.out.println(FORMAT_NINETEEN.format(LocalDateTime.now()));}
原文地址:https://www.cnblogs.com/zhougf/p/11422450.html
时间: 2024-11-12 21:09:56