How do I calculate number of days between two dates using Python? -
if have 2 dates (ex. '8/18/2008'
, '9/26/2008'
) best way number of days between 2 dates?
if have 2 date objects, can subtract them.
from datetime import date d0 = date(2008, 8, 18) d1 = date(2008, 9, 26) delta = d0 - d1 print delta.days
the relevant section of docs: https://docs.python.org/library/datetime.html
Comments
Post a Comment