Inspectopedia 2025.2 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.

Examples:

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

By ID

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

SuspiciousDateFormat
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

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection SuspiciousDateFormat

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025