I have a given data, for example:
"2021-12-01 12:00:00" (i.e., %Y-%m-%d %H:%M:%S)
and a given millisecond: 3599.9. I wish to add this millisecond to the previus date in order to have the following format:
%Y-%m-%d %H:%M:%S.%f or %Y-%m-%d %H:%M:%S:%f
I found some example, but all starting with datetime.utcnow(). For example:
>>> from datetime import datetime
>>> (dt, micro) = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f').split('.')
>>> "%s.%03d" % (dt, int(micro) / 1000)
'2016-02-26 04:37:53.133'
Here's an example of how you could achieve that: