Java: How to get the current date (and time) in Java 8, 11, 14, 17, etc.
Java date/time FAQ: How do I get the current date (i.e., now or today) in Java? Also how do I get the current time in Java?
Solution
With Java 8 and newer — i.e., Java 11, 14, 17, etc. — use any of the follow “now” methods on these Java classes to get the current data and time: