-1

How to convert "2013-10-21 12:00:00.004" to datetime object in Python? The problem is there is decimal number in seconds.

user5025141
  • 399
  • 1
  • 3
  • 15

1 Answers1

0

here is a working example

import datetime

dt =  datetime.datetime.strptime("2013-10-21 12:00:00.004", "%Y-%m-%d %H:%M:%S.%f")
print (dt.microsecond)
Yoav Glazner
  • 7,936
  • 1
  • 19
  • 36