Вопрос

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