import time import datetime today = int(time.strftime('%w')) print today anyday = datetime.datetime(2012, 04, 22).strftime('%w') print anyday