Convert a date string into YYYYMMDD

前端 未结 3 2284
北荒
北荒 2021-02-14 22:42

I\'ve got a bunch of date strings in this form: -

30th November 2009
31st March 2010
30th September 2010

I want them like this: -



        
3条回答
  •  孤独总比滥情好
    2021-02-14 23:13

    In python 3.7, you can use isoformat()

    >>> from datetime import datetime
    >>> datetime.today().date().isoformat().replace("-", "")
    '20190220'
    

提交回复
热议问题