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
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
Comments
Post a Comment