Inspectopedia Help

Suspicious date format pattern

Reports date format patterns that are likely used by mistake.

The following patterns are reported:

  • Uppercase "Y", unless "w" appears nearby. It stands for "Week year" that is almost always the same as normal "Year" (lowercase "y" pattern), but may point to the next year at the end of December.

  • Uppercase "M" (month) close to "H", "K", "h", or "k" (hour). It's likely that a lowercase "m" (minute) was intended.

  • Lowercase "m" (minute) close to "y" (year) or "d" (day in month). It's likely that an uppercase "M" (month) was intended.

  • Uppercase "D" (day in year) close to "M", or "L" (month). It's likely that a lowercase "d" (day in month) was intended.

  • Uppercase "S" (milliseconds) close to "m" (minutes). It's likely that a lowercase "s" (seconds) was intended.


new SimpleDateFormat("YYYY-MM-dd"): likely "yyyy-MM-dd" was intended.

new SimpleDateFormat("yyyy-MM-DD"): likely "yyyy-MM-dd" was intended.

new SimpleDateFormat("HH:MM"): likely "HH:mm" was intended.

Locating this inspection


Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Probable bugs

New in 2020.1


By default bundled with

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin

Java, 241.18072

Last modified: 18 June 2024