Question

I have datetime field

 start_date = datetime.today()-timedelta(days= 30*num)

not i want to get week number

Week = start_date.isocalander()[1]

I am finding problem in converting date to week number

Était-ce utile?

La solution

It helps to check the spelling from the docs or using dir()

>>> start_date = datetime.today() - timedelta(days=30)
>>> start_date
datetime.datetime(2013, 7, 24, 13, 37, 11, 869997)
>>> start_date.isocalendar()[1]
30
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top