How to convert Julian date to standard date?

后端 未结 4 757
不知归路
不知归路 2021-01-12 17:48

I have a string as Julian date like \"16152\" meaning 152\'nd day of 2016 or \"15234\" meaning 234\'th day of 2015.

How can I convert these

4条回答
  •  抹茶落季
    2021-01-12 18:32

    Easy way

    • Convert from regular date to Julian date

    print datetime.datetime.now().strftime("%y%j")

    • Convert from Julian date to regular date

    print datetime.datetime.strptime('19155', '%y%j').strftime("%d-%m-%Y")

提交回复
热议问题