Answers for "how to subtract dates in python with time"

0

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)
Posted by: Guest on July-18-2021

Code answers related to "how to subtract dates in python with time"

Python Answers by Framework

Browse Popular Code Answers by Language