I wanted to use arrow
vs datetime
in Python, and I want to convert the following example to arrow
:
end_date = start_date + timedelta(days=5)
The only thing I see in the arrow
docs is:
start_date.replace(weeks=+3)
But I want to assign end_date
with 5 days more than the start_date
- not changing the existing start_date
I don't want to write i.e:
end_date = start_date
end_date.replace(days=+5)
I want to do it in a one-liner ... any idea ?
start_date.replace
doesn't alter start_date
, it returns a new object. So you can just assign that to a new name:
end_date = start_date.replace(days=+5)
Reading the docs is useful.