the format i need is Y-M-D
similar to 2017-12-01
what i've tried :
import datetime
import time
todaysdate = time.strftime("%Y-%m-%d")
print (todaysdate)
end_date = todaysdate+ datetime.timedelta(days=10)
print (end_date)
The first part should get me today's date then i add 10 date to that date and i should have to outputs 1 in str format the other in date format.
EDIT: i changed my code to the following :
from datetime import datetime,timedelta,date
def next_days(days_value):
days_from_now = datetime.now() + timedelta(days=days_value)
return days_from_now
print(next_days(5))
and i got this output 2017-12-06 11:58:45.955056
how do i get 2017-12-06
part only.