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

Was it helpful?

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top