Domanda

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

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top