Extract day of year and Julian day from a string date

前端 未结 9 2055
臣服心动
臣服心动 2020-11-27 06:51

I have a string \"2012.11.07\" in python. I need to convert it to date object and then get an integer value of day of year and also Julian day

9条回答
  •  孤街浪徒
    2020-11-27 07:12

    To simplify the initial steps of abarnert's answer:

    from dateutil import parser
    s = '2012.11.07'
    dt = parser.parse(s)
    

    then apply the rest of abanert's answer.

提交回复
热议问题