60. Getting the current date/time without time/date

Before JDK 8, the solution must focus on the java.util.Date class. The code that is bundled to this book contains this solution.

Starting with JDK 8, the date and time can be obtained via the dedicated classes, LocalDate and LocalTime, from the java.time package:

// 2019-02-24
LocalDate onlyDate = LocalDate.now();

// 12:53:28.812637300
LocalTime onlyTime = LocalTime.now();
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.12.232