How to get date and time in java?

How to get date and time in Java?

Hi Noah Smith,

To acquire the date and time in Java, use the below command:

DateTimeFormatter dtf1 = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); LocalDateTime now = LocalDateTime.now();