Search code examples
pythonpython-3.xdatetimepython-3.7

Python convert date format


Given a string like this:

2020-08-14

How do I convert it to:

14 August 2020

Using python 3?


Solution

  • An alternative approach using pandas function below:

    import pandas as pd
    d = pd.to_datetime('2020-08-14')
    d.strftime('%d %B %Y')
    Out[11]: '14 August 2020'