On 24/03/2006 5:18 AM, Dennis Lee Bieber wrote:
> On 23 Mar 2006 09:37:13 -0800, "vj" <[EMAIL PROTECTED]> declaimed the
> following in comp.lang.python:
> 
> 
>>I'm doing:
>>
>>a = now()
>>delta = ReltaiveDateTime(days=+6, weekday(mx.DateTime.Friday, 0))
>>Next Friday: a+delta
>>
>>a: march 23
>>a+delta: Gives me March 31st and not March 24th
>>
>>Any ideas?
> 
> 
>       Off-hand? (Since I don't think I have that function)...
> 
>       Don't add the 6... It would appear that you are jumping over the
> 24th, and then picking up the first Friday that follows the result of
> jumping.

Good call, Dennis.

vj: It would help for future questions if you were to copy and paste 
code that you had actually run, rather than typing it from memory. There 
are TWO typos in what your wrote. It would also help if you showed 
exactly what import statement(s) were used, as in the following (where I 
have substituted Saturday for Friday, in the interests of reproducing 
your (volatile) test case).

 >>> from mx.DateTime import *
 >>> a = now()
 >>> a
<DateTime object for '2006-03-24 06:13:46.89' at b00760>
 >>> delta=RelativeDateTime(days=6, weekday=(Saturday, 0))
 >>> a + delta
<DateTime object for '2006-04-01 06:13:46.89' at ae6620>
 >>> delta=RelativeDateTime(weekday=(Saturday, 0))
 >>> a + delta
<DateTime object for '2006-03-25 06:13:46.89' at b00aa0>
 >>>

Hope this helps,
John
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to