Datetime question
Diez B. Roggisch
deets at nospam.web.de
Thu Aug 3 08:55:18 EDT 2006
Lad schrieb:
> In a datetime object I would like to change days and hours.
> Or in other words, I would like to copy this datetime object but
> increase days and hours.
> Is it possible?
> For example:If I have a datetime object like this
> datetime.datetime(2006, 8, 3, 14, 13, 56, 609000)
>
> I would like to make a new ,for example like this
>
> datetime.datetime(2006, 8, 12, 10, 13, 56, 609000)
>
> is it possible to do so?
you'd been pointed to the resources yesterday - please read manuals
carefully!
a = datetime.datetime(2006, 8, 12, 10, 13, 56, 609000)
b = a + datetime.timedelta(days=-2, hours=-4)
Diez
More information about the Python-list
mailing list