Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python calc days between dates

from datetime import date

d0 = date(2008, 8, 18)
d1 = date(2008, 9, 26)
delta = d1 - d0
print(delta.days)
Comment

calculate days between two dates python

from datetime import date

startDate = date(2021, 7, 19)
endDate = date(2021, 11, 12)
delta = startDate - endDate
print(delta.days)
Comment

days calculator python

import datetime
def Days_Calculator():
    '''create a python function that takes 2 dates and prints how
    many days between the 2 dates'''
    fdate, ldate = input("enter first date :"), input("enter second date :")
    # enter first date :24 2 2022
	# enter second date :13 10 2022
    fdate, ldate = fdate.split(" "), ldate.split(" ")
    date_1 = datetime.date(int(fdate[-1]), int(fdate[1]), int(fdate[0]))
    date_2 = datetime.date(int(ldate[-1]), int(ldate[1]), int(ldate[0]))
    delta = date_2-date_1
    print(f"number of days is {delta.days} ")
    # number of days is 231 
Days_Calculator()
Comment

PREVIOUS NEXT
Code Example
Python :: django reverse 
Python :: message on member joining discord.py 
Python :: python querystring parse 
Python :: marks input using list in python 
Python :: python get current time without milliseconds 
Python :: pandas groupby as new column 
Python :: plt plot circle 
Python :: how to make a text input box python pygame 
Python :: creating a 50 day and 100 day moving average python 
Python :: python float to string n decimals 
Python :: find location of library python linux 
Python :: fraction thesis 
Python :: pandas find top 10 values in column 
Python :: python exit button 
Python :: mp4 to mp3 in python 
Python :: hello worldpython 
Python :: python hour from date 
Python :: close turtle window python 
Python :: how to get the angle of mouse from the center formulae 
Python :: reduced fraction python 
Python :: PySpark null or missing values 
Python :: change the default python version mac 
Python :: set font size xaxis pandas 
Python :: print time python 
Python :: sns lineplot title 
Python :: adjust tick label size matplotlib 
Python :: how to add numbers in python using for loop 
Python :: cv2 resize 
Python :: create folders in python 
Python :: calculate highest frequency or mode in pandas dataframe 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =