KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Using Python I would like to find the date object for last Wednesday. I can figure out where today is on the calendar using isocalendar, and determine whether or not we need to go back a week to get to the previous Wednesday. However, I can't figure out how to create a new date object with that information. Essentially, I need to figure out how to create a date from an iso calendar tuple. from datetime import date today = date.today() if today.isocalendar()[2] > 3: #day of week starting with Monday #get date for Wednesday of last week else: #get date for Wednesday of this current week
Tags (comma-separated)
Save Edits
Cancel