Issue
I get date in format(YYYY-MM-DD)
Then I want to add timedelta
mydate + timedelta(days=1)
and I get error
coercing to Unicode: need string or buffer, datetime.timedelta found
Solution
mydate
is a string. Try doing this:
from datetime import datetime
parsed_date = datetime.strptime(mydate, "%Y-%m-%d")
new_date = parsed_date + timedelta(days=1)
Answered By - Christian Ternus
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.