Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
import datetime
week_number = datetime.datetime.today().isocalendar()[1]
print(week_number)
1. Take the date datetime then translate it into days, days and months,
2. then divide by 7, if the number was divisible by 7, do nothing, if it was not divided by 7, then add 1
3. remove the fractional part - here you have the week number
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question