Created
August 5, 2013 18:54
-
-
Save mittenchops/6158416 to your computer and use it in GitHub Desktop.
Add weeks to time in MMM DDth YYYY format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dateutil import parser | |
from datetime import timedelta | |
date = "Mar 11th 2013" | |
def addweeks(date,week=0): | |
x = parser.parse(date) | |
new = x + timedelta(weeks=week) | |
return(new.strftime("%b %d %Y")) | |
>>> addweeks(date,10) | |
'May 20 2013' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment