Python does make it look simple ...
# day of the week of a given date
# date.weekday() returns 0 for Monday and so on, so pick the string from a list
from datetime import date
oldDate = date(1911, 11, 11) # year, month, day
dayofWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
print "The day of the week on %s was a %s" % (oldDate.strftime("%d%b%Y"), dayofWeek[date.weekday(oldDate)])
Last edited by vegaseat; Sep 23rd, 2008 at 11:53 pm. Reason: replace disfunctional php tags
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
Offline 5,792 posts
since Oct 2004