سؤال

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

هل كانت مفيدة؟

المحلول

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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top