[Python-Dev] dateutil
Moore, Paul
Paul.Moore at atosorigin.com
Mon Mar 15 09:30:21 EST 2004
From: Gustavo Niemeyer [mailto:niemeyer at conectiva.com]
>> > d.forward_months(3).end_of_month()
>>
>> In dateutil, I think it's d + relativedelta(months=+1, day=1, days=-1).
>> Arguably, this is fairly trivial (highly non-obvious, but trivial...)
>
> Yes, it'd work, but "d + relativedelta(day=31)" would be enough.
Hmm, I feel vaguely uncomfortable actually relying on the "round down out
of range values" behaviour. Presumably day=1000 would also work, and would
look even stranger to me :-)
Paul.
More information about the Python-Dev
mailing list