Re: datetime.timedelta.replace?

2013-10-11 Thread Joshua Landau
On 9 October 2013 16:15, Skip Montanaro s...@pobox.com wrote: Datetime objects have a replace method, but timedelta objects don't. If I take the diff of two datetimes and want to zero out the microseconds field, is there some way to do it more cleanly than this? delta = dt1 - dt2 zero_delta

datetime.timedelta.replace?

2013-10-09 Thread Skip Montanaro
Datetime objects have a replace method, but timedelta objects don't. If I take the diff of two datetimes and want to zero out the microseconds field, is there some way to do it more cleanly than this? delta = dt1 - dt2 zero_delta = datetime.timedelta(days=delta.days, seconds=delta.seconds) I