Java Tutorials
DateTimeFormatter class located in java.time.format package. Custom Date formats , Time, and DateTime values.
for ex: Date displayed in different countries in Different formats.
Time represented in AM/PM format or 24 hours format
Complete DateTime represented in UTC format or TimeZone Format, and also fraction of seconds, milli seconds, & nano seconds etc.,
jshell> date.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)) $109 ==> "Saturday, 1 January, 2000" jshell> date.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG)) $110 ==> "1 January 2000" jshell> date.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)) $111 ==> "01-Jan-2000" jshell> date.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT)) $112 ==> "01/01/00" M MM MMM MMMM 4 04 Apr April
ADS