Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to subtract dates in Python

from datetime import datetime

def days_between(d1, d2):
    d1 = datetime.strptime(d1, "%Y-%m-%d")
    d2 = datetime.strptime(d2, "%Y-%m-%d")
    return abs((d2 - d1).days)
Comment

PREVIOUS NEXT
Code Example
Python :: scatter plot points density color pandas 
Python :: accuracy sensitivity specificity 
Python :: theta hat symbol python code 
Python :: how to run a seaborn plot on pycharm 
Python :: python format method align center 
Python :: PHP echo multiple lines example Using Heredoc 
Python :: TypeError: sequence item 1: expected str instance, NoneType found 
Python :: printing multiple input in python 
Python :: Python - Cómo Jugar archivo Mp3 
Python :: how to open camre aopencv 
Python :: online python debugger 
Python :: gwt height with tkinker 
Python :: How to compress image field in django? 
Python :: a = np.array([0, 0, 0]) and a = np.array([[0, 0, 0]]) 
Python :: num1=int(self.t1.get()) 
Python :: df.loc 
Python :: pandas : stratification (mean) 
Python :: python union type 
Python :: python wait for executable to finish before perceeding 
Python :: networkx select edge 
Python :: How to test if a webpage is an image python requests 
Python :: timeplanner-1 
Python :: access data in one python function from another 
Python :: File "<ipython-input-12-48c6c043344b", line 29 coin = random.randint(0,1) ^ IndentationError: expected an indented block 
Python :: python discover methods of object/module 
Python :: qcut and cut function in python stack overflow 
Python :: make a coo_matrix 
Python :: save multiple df to pkl 
Python :: pvector python processing 
Python :: os.startfile on raspberry 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =