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 :: python pop up box 
Python :: logging the terminal output to a file 
Python :: Python - Drop row if two columns are NaN 
Python :: use python type hint for multiple return values 
Python :: convert torch to numpy 
Python :: where to import reverse_lazy in django 
Python :: how to run python code on github 
Python :: how to make a forever loop in python 
Python :: get request header flask 
Python :: clock in python 
Python :: python open folder in explorer 
Python :: position of legend matplotlib 
Python :: torchviz 
Python :: python find location of module 
Python :: from django.conf.urls import patterns 
Python :: mark_safe django 
Python :: access-control-allow-origin django 
Python :: pandas to csv float format 
Python :: binomial coefficient python 
Python :: python utf8 
Python :: what is wsgi in python 
Python :: python - make a copy of a df 
Python :: how to make a kivy label multiline text 
Python :: django.core.exceptions.ImproperlyConfigured 
Python :: play music with time in python 
Python :: python requests cookies 
Python :: json indent options python 
Python :: shutil copy folder 
Python :: python - removeempy space in a cell 
Python :: fuzzy lookup in python 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =