// 得到當前日期時間 LocalDateTime now = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 將日期時間格式化為字串 String format = now.format(formatter); System.out.println("format = " + format);
// 得到當前日期時間 LocalDateTime now = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 將日期時間格式化為字串 String format = now.format(formatter); System.out.println("format = " + format);