Validate the datetime value: Difference between revisions
Jump to navigation
Jump to search
→MySQL approach
m (Text replacement - "Category:Text file processing" to "Category:String manipulation") |
|||
| Line 4: | Line 4: | ||
== MySQL approach == | == MySQL approach == | ||
Verify the value of {{kbd | key=DAY()}}<ref>[https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html MySQL :: MySQL 8.0 Reference Manual :: 12.7 Date and Time Functions]</ref> is NULL | |||
<pre> | |||
SELECT `my_date_column` | |||
FROM `my_table` | |||
WHERE DAY(`my_date_column`) IS NULL; | |||
</pre> | |||
<pre> | <pre> | ||
SELECT `my_date_column`, STR_TO_DATE(`my_date_column`, '%Y-%m-%d') | SELECT `my_date_column`, STR_TO_DATE(`my_date_column`, '%Y-%m-%d') | ||