I'm trying to add a timedelta of +1 days to my datetime object using:
.timedelta(days=1)
With:
datetime.now(pytz.timezone('Europe/London')).strftime("%d%m%Y")`
But for some reason, it's not working as it doesn't allow it to be put anywhere in that line.
I've also tried:
GMTDAY = datetime.now(pytz.timezone('Europe/London'))
GMTDAY = str(GMTDAY + timedelta(days=1))
GMTDAY = datetime(int(GMTDAY)).strftime("%d%m%Y")
But that returns:
invalid literal for int() with base 10: '2016-04-28 02:50:52.436000+01:00'
Any idea what I am doing wrong and how to solve it?
EDIT:
It's not a duplicate because this one is specifically about doing it with pytz, it's easy to do it without pytz.
If I interpreted correctly what you are trying to do, try something like:
GMTDAY = datetime.now(pytz.timezone('Europe/London'))
GMTDAY += timedelta(days=1)
tomorrow = GMTDAY.strftime("%d-%m-%Y")
print(tomorrow)
Output:
28-04-2016