adelaide_mike wrote:
> This should really be a Python enquiry, but I am sure someone will
> know:
> 
> I need to calculate the date 12 weeks before today.  What is the best
> way?  TIA

This might give you a clue ...

from datetime import date

def anniversary_this_week(self, tday=date.today()):
     anniversary = self.birthdate.replace(year=tday.year)
     diff = anniversary.toordinal() - tday.toordinal()
     if diff < -358 or (diff >= 0 and diff <=7):
         return 'Yes'
     return 'No'

> 
> Mike
> > 
> 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to