newvem / pytz

MIT License
60 stars 12 forks source link

Match for milliseconds #6

Closed luvpreetsingh closed 5 years ago

luvpreetsingh commented 7 years ago

2017-05-11 17:05:13.0

What should I do for milliseconds ?

datetime_obj = datetime.strptime(date,"%Y-%m-%d %H:%M:%S.%ms")

I did the above, but got this,

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/_strptime.py", line 308, in _strptime
    format_regex = _TimeRE_cache.compile(format)
  File "/usr/lib/python2.7/_strptime.py", line 265, in compile
    return re_compile(self.pattern(format), IGNORECASE)
  File "/home/alphauser/Envs/vogo-alpha/lib/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/home/alphauser/Envs/vogo-alpha/lib/python2.7/re.py", line 244, in _compile
    raise error, v # invalid expression
 sre_constants.error: redefinition of group name 'm' as group 7; was group 2