I have timestamp which is a time object and trying to convert it to a datetime object because datetime has stonger capabilities and I need to use some function that only datetime has.
The reason I'm starting with time is because datetime doesn't support milliseconds which the original string contains.
What is the easiest way to do it?
time.strftimedoesn't support printing milli or microsecond. unlikedatetime.strftimedocs.python.org/3/library/… . (and the same aboutstrptime..)strftime. please clarify if this should be helpful for others.datetime.time(1,2,3,444000).strftime('%H:%M:%S.%f')[:-3]time.strptime.. BUT, you are right.. I'll flag the question as duplicate. Thanks for the interesting discussion