Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Does this answer your question? Add time to datetime Nowhere in the linked questions do they add a timedelta to a string. They always parse the string to a datetime object using strptime and then they add the timedelta Commented Jul 19, 2022 at 13:11
  • But I would like to know if this is directly possible without converting it Commented Jul 19, 2022 at 13:14
  • @PeterBe, without converting to datetime? Commented Jul 19, 2022 at 13:16
  • No, it is not possible. You're going to have to parse the elements of that string to figure out what needs to be added to what, and if you're doing that you might as well use the datetime.strptime function to parse it instead of reinventing the wheel. Commented Jul 19, 2022 at 13:18