PhpStorm 2023.3 Help

Code Inspection: Ill-formed date/time literals

Reports errors in date and time literals. This inspection is available in MySQL, Oracle, Db2, and H2.

Example (MySQL):

SELECT TIME '10 -12:13:14' FROM dual; SELECT TIME ' 12 : 13 : 14 ' FROM dual; SELECT TIME '12 13 14' FROM dual; SELECT TIME '12-13-14' FROM dual; SELECT TIME '12.13.14' FROM dual; SELECT TIME '12:13:' FROM dual; SELECT TIME '12:13' FROM dual; SELECT TIME '12:' FROM dual;

In this example, dates ignore the MySQL standard for date and time literals. Therefore, they will be highlighted. For more information about date and time literals in MySQL, refer to Date and Time Literals at dev.mysql.com.

The following date and type literals are valid for MySQL.

SELECT TIME '12:13:14' FROM dual; SELECT TIME '12:13:14.555' FROM dual; SELECT TIME '12:13:14.' FROM dual; SELECT TIME '-12:13:14' FROM dual; SELECT TIME '10 12:13:14' FROM dual; SELECT TIME '-10 12:13:14' FROM dual;

Suppress an inspection in the editor

  1. Place the caret at the highlighted line and press Alt+Enter or click the Intention action icon.

  2. Click the arrow next to the inspection you want to suppress and select the necessary suppress action.

Last modified: 25 March 2024