Get current date and time with the SimpleDateFormat class



This class prints current date and time by creating a Date object and using instances of SimpleDateFormat to format the Date object.
See the SimpleDateFormat api reference for more format options.

UPDATE

From Java 8 there’s a new date API. To get the current date in different formats with this new API check out the following links:

Display date in different formats with the LocalDate class

Get current date and time with the LocalDateTime class







Search for more Java info on this site here:
Custom Search


Please type any questions here.