I am able to parse strings containing date/time with time.strptime How can I parse a time string that contains milliseconds? Answer Python 2.6 added a new strftime/strptime macro %f. The docs are a bit misleading as they only mention microseconds, but %f actually parses any decimal fraction of seconds with up to 6 digits, meaning it also works for milliseconds