How to tell how many weeks apart two datetimes are?

Roy Smith roy at panix.com
Tue Jan 8 22:22:09 CET 2013


How do you tell how many weeks apart two datetimes (t1 and t2) are?
The "obvious" solution would be:

weeks = (t2 - t1) / timedelta(days=7)

but that doesn't appear to be allowed.  Is there some fundamental
reason why timedelta division not supported?



More information about the Python-list mailing list