the datetime object appears to have a replace method which could achieve what you want to do, albeith with some computation from your end first,
 
>>> d = datetime.datetime(2006, 8, 3, 14, 13, 56, 609000)
>>> dir(d)
['__add__', '__class__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getatt
ribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__ne
w__', '__radd__', '__reduce__', '__reduce_ex__', '__repr__', '__rsub__', '__seta
ttr__', '__str__', '__sub__', 'astimezone', 'combine', 'ctime', 'date', 'day', '
dst', 'fromordinal', 'fromtimestamp', 'hour', 'isocalendar', 'isoformat', 'isowe
ekday', 'max', 'microsecond', 'min', 'minute', 'month', 'now', 'replace', 'resol
ution', 'second', 'strftime', 'time', 'timetuple', 'timetz', 'today', 'toordinal
', 'tzinfo', 'tzname', 'utcfromtimestamp', 'utcnow', 'utcoffset', 'utctimetuple'
, 'weekday', 'year']
>>> d.replace(year=2007)
datetime.datetime(2007, 8, 3, 14, 13, 56, 609000)
>>>
 
thanks,
Rama


 
On 3 Aug 2006 05:26:31 -0700, Lad <[EMAIL PROTECTED]> wrote:
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?
Thank you
L

--
http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to