0

I have two fields that I need to parse and combine together to form a full datetime field.

The first field is a date field but in the form of a datetime field already, like 2021-09-02 00:00:00.000000. The second field is a timestamp field: 18:00:00.

I want to combine these two fields to be like this: 2021-09-02 18:00:00.000000.

I'm struggling to do this with the datetime package. I've tried string parsing and putting them together but can't get anything to work.

simplycoding
  • 2,770
  • 9
  • 46
  • 91
  • 2
    Are you looking for [datetime.combine](https://docs.python.org/3/library/datetime.html#datetime.datetime.combine)? – Wondercricket May 13 '22 at 19:09
  • Does this answer your question? [Pythonic way to combine datetime.date and datetime.time objects](https://stackoverflow.com/questions/8474670/pythonic-way-to-combine-datetime-date-and-datetime-time-objects) – FObersteiner May 13 '22 at 19:21
  • Dear @simplycoding, can you share some code that you have already tried to code, it will be easy to help you from an example. – Gedeon Mutshipayi May 13 '22 at 19:21

0 Answers0