snippet: view plain - save this
1 >>> from datetime import datetime
2 >>> from time import strptime
3 >>> s="2007-10-01T02:06:54Z"
4 >>> datetime(*strptime(s,"%Y-%m-%dT%H:%M:%SZ")[0:6])
5 datetime.datetime(2007, 10, 1, 2, 6, 54)
Many file formats and standards use the ISO 8601 date format (e.g. 2007-01-14T20:34:22+00:00) to store dates in a neutral, unambiguous manner. Here is a way to convert them in datetime format
1 >>> from datetime import datetime
2 >>> from time import strptime
3 >>> s="2007-10-01T02:06:54Z"
4 >>> datetime(*strptime(s,"%Y-%m-%dT%H:%M:%SZ")[0:6])
5 datetime.datetime(2007, 10, 1, 2, 6, 54)
Many file formats and standards use the ISO 8601 date format (e.g. 2007-01-14T20:34:22+00:00) to store dates in a neutral, unambiguous manner. Here is a way to convert them in datetime format
0 comments