Java examples for Date Time:Local Date Time
Use the Date-Time API to obtain the current date.
The LocalDate class represents an ISO calendar in the year-month-day format.
import java.text.DateFormatSymbols; import java.time.Clock; import java.time.LocalDate; import java.util.Calendar; public class Main { public static void main(String[] args) { LocalDate date = LocalDate.now(); System.out.println("Current Date: " + date); Clock clock = Clock.systemUTC(); date = LocalDate.now(clock); System.out.println("Date from clock: " + date); }//from www.ja va 2 s . c om }