Reputation: 680
I have a string '10/01/2016 00:00'
that I want convert to DATETIME
I tried like this:
select STR_TO_DATE('10/01/2016 00:00', '%d/%m/%Y %h:%i');
But it's not working. what i am doing wrong?
Upvotes: 2
Views: 403
Reputation: 49089
The problem is that %h
expects an hour in the format 01-12 and you are providing an hour that is 00. You can use %H
that expects an hour in the format 00-23, try with this:
select STR_TO_DATE('10/01/2016 00:00', '%d/%m/%Y %H:%i');
Upvotes: 2