STINNER Victor added the comment: > How does it parse this date: > 2016-02-15T11:59:46.16588638674+09:00
Mathieu Dupuy added the comment: > discarding the microseconds digits after the 6th. Hum, you should use the same rounding method than datetime.datetime.fromtimestamp(): ROUND_HALF_UP, as round(). In practice, you can for example pass a floating point number as microseconds to datetime.datetime constructor. Since datetime is implemented in C, I'm not sure that using the re is the best choice. Since the regex looks simple enough, we may parse the string without the re module. Well, maybe only for the C implementation. What is the behaviour is there are spaces before/after the string? What if there are other characters like letters before/after? You should add an unit test for that. I expect an error when parsing "t=2012-04-23T09:15:00" for example. Your regex ends with $ but doesn't start with ^. Using re.match(), ^ and $ are probably not needed, but I'm not confident when I use regex :-) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15873> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com