xxxxxxxxxx
The Date in Java is not only a data type, like int or float, but a class. This means it has its own methods available for use. A Date in Java also includes the time, the year, the name of the day of the week, and the time zone. One of its methods includes extracting the time from the Date object
xxxxxxxxxx
import java.util.Date;
Date currentDate = new Date(); // Create a new Date object with the current date and time
System.out.println(currentDate); // Print the current date and time