The document discusses displaying the current date, time, and date and time in Java. It recommends importing the LocalDate, LocalTime, and LocalDateTime classes from java.time and using their now() method to get the current date, time, or date and time respectively in just a few lines of code.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
69 views4 pages
Date & Time: Etl Labs PVT LTD - Java Programming
The document discusses displaying the current date, time, and date and time in Java. It recommends importing the LocalDate, LocalTime, and LocalDateTime classes from java.time and using their now() method to get the current date, time, or date and time respectively in just a few lines of code.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4
Date & Time
ETL LABS PVT LTD – JAVA PROGRAMMING 128
Display Current Date To display the current date, import the 3 java.time.LocalDate class, and use its now() method:
ETL LABS PVT LTD – JAVA PROGRAMMING 129
Display Current Time To display the current time (hour, minute, 4 second, and microsecond), import the java.time.LocalTime class, and use its now() method:
ETL LABS PVT LTD – JAVA PROGRAMMING 130
Display Current Date and Time To display the current date and time, import the java.time.LocalDateTime class, and use 3 its now() method: