I need to get an ISO 8601 date that only displays the week number and two digit year code for a given date in python 3.0. This needs to be in the following format: YYWW (YY represents a two digit year code and WW represents the week number). I have tried working with the datetime module in python and using %G and %V to get the week number using strftime, but get a value error when running the following code:
from datetime import datetime
now_iso = (datetime.now().strftime('%G%V'))
Any help you can provide would be greatly appreciated. Thanks in advance. Here is the error I get:
Traceback (most recent call last):
File "C:\Python27\Lib\lib-tk\Tkinter.py", line 1547, in __call__
return self.func(*args)
File "C:/Users/ctschantz/Python Project 3/Solenoids Label Program.py", line 881, in close_part
part_validation()
File "C:/Users/ctschantz/Python Project 3/Solenoids Label Program.py", line 245, in part_validation
part_label_create()
File "C:/Users/ctschantz/Python Project 3/Solenoids Label Program.py", line 58, in part_label_create
now_bc = (datetime.now().strftime('%G%V'))
ValueError: Invalid format string