September 2019
Intermediate to advanced
816 pages
18h 47m
English
The previous problem contains some flavors of formatting date and time via SimpleDateFormat.format() and DateTimeFormatter.format(). In order to define format patterns, the developer must be aware of the format pattern syntax. In other words, the developer must be aware of the set of symbols that are used by the Java date-time API in order to recognize a valid format pattern.
Most of the symbols are common to SimpleDateFormat (before JDK 8) and to DateTimeFormatter (starting with JDK 8). The following table lists the most common symbols—the complete list is available in the JDK documentation:
|
Letter |
Meaning |
Presentation |
Example |
|
y |
year |
year |
1994; 94 |
|
M |
month of year |
number/text |
7; ... |