import datetime
a = time.strptime(str(download_time), "%Y-%m-%d %H:%M:%S")#download_time为给定的日期例如(2020-05-25 00:00:00)
y = a.tm_year
m = a.tm_mon
d = a.tm_mday
weeknum = datetime.datetime(int(y), int(m), int(d)).isocalendar()[1] #一年中的第几周
import datetime
a = time.strptime(str(download_time), "%Y-%m-%d %H:%M:%S")#download_time为给定的日期例如(2020-05-25 00:00:00)
y = a.tm_year
m = a.tm_mon
d = a.tm_mday
weeknum = datetime.datetime(int(y), int(m), int(d)).isocalendar()[1] #一年中的第几周
本文标题:python给指定日期获取它是当年的第几周
本文链接:https://www.haomeiwen.com/subject/dlfbzhtx.html
网友评论