The SimpleDateFormat class is used to format instances of the Date class as strings using a pattern.

The SimpleDateFormat class is now a legacy class; the DateTimeFormatter is a more up to date alternative as part of the new java.time API.

Pattern

Locale

Empty input

Java version: 1.8.0_171

Common Issues