Please help to Convert string "mm/2d/4y 2h:mm" to datetime 4y-mm-2d 2h:mm in MySQL STR_TO_DATE to convert mm/2d/4y to 4y-mm-2h only. Thank you so much!
Asked
Active
Viewed 264 times
0
-
[STR_TO_DATE](https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_str-to-date) to the rescue. – danblack Aug 13 '21 at 02:52
-
Try `DATE_FORMAT(colName, '%Y-%m-%d %h:%i')` – Kuro Neko Aug 13 '21 at 02:56
-
1Does this answer your question? [Mysql: Setup the format of DATETIME to 'DD-MM-YYYY HH:MM:SS' when creating a table](https://stackoverflow.com/questions/8338031/mysql-setup-the-format-of-datetime-to-dd-mm-yyyy-hhmmss-when-creating-a-tab) – Kuro Neko Aug 13 '21 at 02:58