Convert numeric date format (YYYYMMDD; 20150101) into Year-Month

前端 未结 3 1994
你的背包
你的背包 2021-01-20 02:37

Can anyone of you help in converting the date from 20150101 to abbreviated form Jan-2015 ?

I tried the below method.

x = 20         


        
3条回答
  •  日久生厌
    2021-01-20 03:12

    You can use a combination of strptime to convert the string to a date object and format to format to what you want:

    date = "20150101"
    format(strptime(date,format="%Y%m%d"),"%b-%Y")
    

提交回复
热议问题