Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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

0 votes
asked Feb 22, 2019 by rgb48 (120 points)

3 Answers

–1 vote
answered Feb 26, 2019 by Papero
def function(today_date):

     print "yesterday", today_date - 1

     print "tomorrow", today_date + 1
0 votes
answered Nov 7, 2019 by dheeraj (1,090 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
0 votes
answered Feb 5, 2020 by Nando Abreu (970 points)
You would have to write a full library, when all work is done by datetime import.

Why do you need not to import datetime?
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.
...