i'm using my backup script since 2011 and had no problems at all. But since start of 2013 I'm getting problem with the correct week number.
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strftime("%W", time.localtime())
'02'
But we have week number 3
Am i doing something wrong? It was working till 2013.
Thanks.
"""Week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Monday are considered to be in week 0."""
What you are looking for is the value for the week number as defined through the ISO standard.
Look at the isoweek module.
>>> from isoweek import Week
>>> Week.thisweek()
isoweek.Week(2013, 3)
>>> Week.thisweek().week
3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With