Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the astra domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/sqrtyhjzaqx471/public_html/wp-includes/functions.php on line 6121

Home Forums MYSQL How to convert text column to datetime in SQL? Reply To: How to convert text column to datetime in SQL?

#115
avi
Participant

Step 1: Add new Column
ALTER TABLE table_name ADD (duplicate_column datetime);
Step 2: Update new Column with existing value
UPDATE table_name SET duplicate_column = str_to_date(column_name, '%d-%m-%Y %h:%i:%s');

Scroll to Top