xxxxxxxxxx
LocalDateTime Formatting Example
// Get current date time
LocalDateTime currentDateTime = LocalDateTime.now();
// Inbuilt format
static DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
// Custom format if needed
//DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// Format LocalDateTime
String formattedDateTime = currentDateTime.format(formatter);
// Verify
System.out.println("Formatted LocalDateTime : " + formattedDateTime);