>>> from datetime import datetime, timedelta
>>> factor = timedelta(7)
>>> now = datetime.now()
>>> past_week = now - factor
>>> past_week
datetime.datetime(*2011, 12, 31*, 18, 12, 22, 417567)
>>>


On Sat, Jan 7, 2012 at 6:06 PM, Adrian Edwards <aedward...@gmail.com> wrote:

> Hello,
>
> What's the best way to calculate deltas between 2 dates? For example I
> need to calculate how many days are inbetwen 12/31/2011 and today.
> Then if the delta is a factor of 7 (weekly) do something.
>
> Thanks.
> Adrian




-- 

Bruno Rocha
[http://rochacbruno.com.br]

Reply via email to