Days between two dates
Just a quick python function to calculate the days between two dates. It is really simple and easy :)
import datetime
def date_diff_days(from_date=datetime.date.today(),to_date=datetime.date.today() ):
return (to_date - from_date).days
And an example to use it:
date1 = datetime.date(2009, 03, 26) date2 = datetime.date(2009, 07, 25) print date_diff_days( date1, date2 )
That’s it :)
Advertisement
Categories: Example, Python, Source code
Python, Sourcecode

Recent Comments