PrintCurrentTime.java 465 B

1234567891011121314
  1. package genlitex_demo.automation_code;
  2. import java.time.LocalDateTime;
  3. import java.time.format.DateTimeFormatter;
  4. public class PrintCurrentTime {
  5. public static void main(String[] args) {
  6. LocalDateTime now = LocalDateTime.now();
  7. DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
  8. String formattedDateTime = now.format(formatter);
  9. System.out.println("Current Time: " + formattedDateTime);
  10. }
  11. }