Is there a means of getting a datetime object as an offset from the
current date?
I need to get the datetime objects for the coming weekend, but if my
result is greater than the number of days in a month it fails rather
than wrapping into the next month. mx.DateTime and datetime.datetime
don't seem to support any such thing - has anybody else done such a
thing or could recommend a fix?

dt = datetime.now()
dt.replace(day=28, month=2)
wd = dt.weekday()
sat = dt.replace(day=dt.day+(5-wd))
sun = dt.replace(day=dt.day+(6-wd))

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: day is out of range for month

Thanks, 


Luke Skibinski Holt


--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to