java set version to current date code example
Example 1: How to get current date and time in java
// get current date and time in java using LocalDate.now() method
import java.time.LocalDate;
public class UsingLocalDate
{
public static void main(String[] args)
{
System.out.println(LocalDate.now());
}
}
Example 2: java how to get current time
import java.util.Calendar;
Date currentTime = Calendar.getInstance().getTime();