Convert diffrent diffrent string date, into one single date formate In mysql -


i have column create_date in sql table, datatype varchar(225). problem is, in column values in different date formats please check attached image enter image description here

i want create column constant_date_format using create _date column, there way?

i have tried mysql str_to_date function :

str_to_date(create_date, '%m/%d/%y')  

it working if create_date column have same date format.

thanks in advance.

you can case when regular expression

select case when create_date regexp [0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9] str_to_date(create_date, '%m-%d-%y') when create_date regexp format str_to_date(create_date, '%m/%d/%y') else create_date end create_date table_name

https://www.guru99.com/regular-expressions.html


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -