I am working on converting human read time into an object datetime. For this I use datetime.datetime.strptime.
However, the simple enough reading time by a person that I have contains fractions of a second that I cannot make out. If it were a constant, I could include it as part of the format. However, since it is not permanent, I cannot do this.
Here is what I am doing right now:
>>> humanTime = '2012/06/10T16:36:20.509Z'
>>> datetime.datetime.strptime(humanTime, "%Y/%m/%dT%H:%M:%SZ")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '2012-06-10T16:36:20.507Z' does not match format '%Y-%m-%dT%H:%M:%SZ'
So, I think the problem here is that the split second is not processed. I don't give a damn about this split second. If you don’t cut the line, is there a way I can ask to datetimeignore the split second (preferably in the format)?
, - . .