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

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -