1
I need this:
strtotime('+10 days');
= PHP
in Django I tried:
import time
struct_time = time.strptime("+10 days")
print "returned tuple: %s " % struct_time
Well, in all the documentation it doesn’t say how to do it the way I want, with everything, I became interested in studying manipulation of team in the python
but, how do I do it strtotime('+10 days')
in the python
?
Following the link from our friend’s comment @hkotsubo
I tried to add 10 days:
datetime.today() - timedelta(days=10)
and to minutes:
datetime.today() - timedelta(minutes=30)
Of course I did, too:
from datetime import datetime, timedelta
Tried to use
timedelta
? -> https://answall.com/a/178846/112052– hkotsubo
@hkotsubo, I tried, but did not understand very well, I just need to add 10 days counting today, and using this same concept, add 30 minutes
– user148010
You saw the link I passed? Just adapt the code you have there:
data = datetime.today() + timedelta(days=10)
. If you want 30 minutes, usetimedelta(minutes=30)
– hkotsubo
It worked here @hkotsubo, this would be a duplicate right?
– user148010
datetime.today() - timedelta(days=10)
is subtracting 10 days, just change the-
for+
:-)– hkotsubo
Yes, if the answer to the other question also solves your case, then it is duplicate..
– hkotsubo