Here's the code to get the date 5 weeks ago from the current date in Python using the datetime
and timedelta
modules:
main.py182 chars8 lines
In this code, we first import the necessary modules, datetime
and timedelta
. We then get the current date and subtract 5 weeks from it using timedelta
. Finally, we print the resulting date using datetime.date()
.
gistlibby LogSnag