datetime: the date of the day one month ago...how?
Max M
maxm at mxm.dk
Wed Apr 12 07:18:20 EDT 2006
gabor wrote:
> hi,
>
> i'm trying to get the date of the day one month ago.
>
> for example:
>
> today = 12.apr.2006
> one-month-ago = 12.mar.2006
>
> so:
>
> one-month-ago(12.apr.2006) = 12.mar.2006
>
> of course sometimes it gets more complicated, like:
>
> one-month-ago(31.mar.2006)
>
> or
>
> one-month-ago(1.jan.2006)
>
> the datetime.timedelta objects only work with hours or days or weeks,
> not month (i understand why)...
>
> but is there a way to calculate this in python?
>
> i really don't want to calculate it by myself :-))
It is application specific. So how *do* you want
one-month-ago(31.mar.2006) or one-month-ago(28.feb.2006) to work? No one
can know but you.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
More information about the Python-list
mailing list