Sep 19, 2018

How to convert month between name and digit in MySQL

select month(str_to_date('March', '%M'))
output: 3
select month(str_to_date('Mar', '%b'))
output: 3
monthname(str_to_date('Mar', '%b'))
output: March