current week / weeks in year - best practice

Aljosa Mohorovic aljosa.mohorovic at gmail.com
Thu Jul 31 15:36:08 CEST 2008


i use this to find out current week and total number of weeks for
current year:
now = datetime.now()
weeks_in_year = int(date(now.year, 12, 31).strftime("%W"))
current_week = int(date(now.year, now.month, now.day).strftime("%W"))

is this the best way or is there a better way?

Aljosa Mohorovic



More information about the Python-list mailing list