3
Contributors
2
Replies
6
Views
12 Years
Discussion Span
Last Post by vegaseat
0

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)])
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.