Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

next day in python without using datetime

import datetime                                 
from datetime import timedelta                  
                                                
d = int(input('enter the day: '))               
m = int(input('enter the month: '))             
y = int(input('enter the year: '))              
                                                
today = datetime.date(y, m, d)                  
tom = today + timedelta(days=1)                 
print('next day is', tom)                       
Comment

next day in python

date = int(input('enter the date: '))
month = int(input('enter the month: '))
year = int(input('enter the year: '))

x = (1, 3, 5, 7, 10)
y = (4, 6, 8, 9, 11)
if month in x and date == 31:
    month = month + 1
    date = 1

elif month in x and date < 31:
    date = date + 1

elif month in y and date == 30:
    month = month + 1
    date = 1

elif month in y and date < 31:
    date = date + 1

elif month == 2 and date == 28 or date == 29:
    month = month+1
    date = 1

elif month == 2 and date < 29:
    date = date+1

elif month == 12 and date < 31:
    date = date + 1

elif month == 12 and date == 31:
    month = 1
    date = 1
    year = year + 1

print('%02d-' % date, '%02d-' % month, '%02d' % year)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas order dataframe by column of other dataframe 
Python :: examples of function in python 
Python :: python read hex file 
Python :: use a library in python 
Python :: dockerize django 
Python :: how to remove text from plot in python 
Python :: librosa python 
Python :: python output text 
Python :: TypeError: method() takes 1 positional argument but 2 were given 
Python :: amazon redshift 
Python :: how to check if all values in list are equal python 
Python :: checking length of sets in python 
Python :: dictionary.com 
Python :: recursion in python 
Python :: python dict items 
Python :: how to generate python code 
Python :: python range from n to 0 
Python :: neat way to print 2d array 
Python :: split strings around given separator/delimiter 
Python :: python find closest date 
Python :: gtk label set label 
Python :: recurrent neural network pytorch 
Python :: programação funcional python - lambda 
Python :: textrank python implementation 
Python :: python split() source code 
Python :: how to normalize scipy cross correlation 
Python :: create django object 
Python :: django url with slug 
Python :: how to import somthing from another directory in pyhon 
Python :: pairs with specific difference 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =