Convert string date into date format in python?

后端 未结 3 647
日久生厌
日久生厌 2021-01-21 05:07

How to convert the below string date into date format in python.

input:
date=\'15-MARCH-2015\'

expected output:
2015-03-15

I tried to use

3条回答
  •  温柔的废话
    2021-01-21 06:05

    You can use easy_date to make it easy:

    import date_converter
    converted_date = date_converter.string_to_string('15-MARCH-2015', '%d-%B-%Y', '%Y-%m-%d')
    

提交回复
热议问题