Is there a way find yesterday and tomorrows date without using import date.time

0 votes
asked Feb 22 by (120 points)

2 Answers

0 votes
answered Feb 26 by Papero
def function(today_date):

     print "yesterday", today_date - 1

     print "tomorrow", today_date + 1
0 votes
answered Nov 7 by (1,070 points)
# DATE
day=int(input('day:'))
month=int(input('month:'))
year=int(input('year'))
a=int(input('hours'))
b=int(input('mins'))
c=int(input('secs'))
if  month==1 or month==3 or month==5 or month==7 or month==8 or month==10 or month==12:
    max_days=31
elif month==2 or month==4 or month==6 or month==11:
    max_days=30
elif year%4==0 and year%100!=0 and year%400==0:
    max_days=29 and month ==2
elif month==2:
    max_days=28
if month<1 or month>12:
    print('invalit month')
elif day<1 or day>max_days:
    print('invalid date')
else:
    print('dd/mm/yy:',day,'/',month,'/',year)
    print('yesterday :',day-1,'/',month,'/',year)
    print('tom0rrow :',day+1,'/',month,'/',year)

OUTPUT

day:3
month:1
year2003
dd/mm/yy: 3 / 1 / 2003
yesterday : 2 / 1 / 2003
tom0rrow : 4 / 1 / 2003                                                            @PYTHON
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...