Skip to content
This repository was archived by the owner on May 7, 2023. It is now read-only.

Files

Latest commit

 

History

History
22 lines (17 loc) · 425 Bytes

days-diff.md

File metadata and controls

22 lines (17 loc) · 425 Bytes
title type tags cover dateModified
Date difference in days
snippet
date
succulent-9
2020-10-28 16:19:39 +0200

Calculates the day difference between two dates.

  • Subtract start from end and use datetime.timedelta.days to get the day difference.
def days_diff(start, end):
  return (end - start).days
from datetime import date

days_diff(date(2020, 10, 25), date(2020, 10, 28)) # 3