Can't call strftime on numpy.datetime64, no definition

前端 未结 1 802
既然无缘
既然无缘 2021-02-11 22:14

I have a datetime64 t that I\'d like to represent as a string.

When I call strftime like this t.strftime(\'%Y.%m.%d\') I get this error:

<
相关标签:
1条回答
  • 2021-02-11 22:54

    Use this code:

    import pandas as pd 
    t= pd.to_datetime(str(date)) 
    timestring = t.strftime('%Y.%m.%d')
    
    0 讨论(0)
提交回复
热议问题