How to convert a date in varchar
to datetime
in the mysql ?
For example:
04-12-2016
to 2016-12-04 16:00:00
04/12/2016
to 2016-12-04 16:00:00
How to convert a date in varchar
to datetime
in the mysql ?
For example:
04-12-2016
to 2016-12-04 16:00:00
04/12/2016
to 2016-12-04 16:00:00
With the bar ( /
):
SELECT str_to_date('06/01/2017 18:26','%m/%d/%Y %H:%i');
With dash ( -
):
SELECT data(str_to_date('06/01/2017 18:26', '%c/%e/%Y %H:%i'), '%Y-%m-%d %H:%m:%s')