Re: Calculating a date

2009-08-05 Thread Mike Dewhirst
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()):

Re: Calculating a date

2009-08-05 Thread Spajderix
From what i know, you can operate on datetime.datetime objects using datetime.timedelta, eg: datetime.datetime.now() - datetime.timedelta(days=84) will give you datetime.datetime object with date of today - 12 weeks Link to manual: http://docs.python.org/library/datetime.html#datetime.timede

Re: Calculating a date

2009-08-05 Thread krylatij
from datetime import date, timedelta a = date.today() - timedelta(7 * 12) print a 2009-05-13 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@goog

Re: Calculating a date

2009-08-05 Thread Mike Ramirez
On Wednesday 05 August 2009 06:01:11 am 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 > > Mike > --~--~-~--~~~---~--~~ > You rece