def isoparse(timestring, formats=("%Y-%m-%d %H:%M:%SZ", "%Y-%m-%d %H:%M:%S")):
"""
>>> isoparse('1970-01-01 00:00:00Z')
0
Also support backwards compatible timestamp format:
>>> isoparse('1970-01-01 00:00:00')
0
"""
for format in formats:
try:
time_tuple = time.strptime(timestring, format)
except ValueError:
continue
else:
return calendar.timegm(time_tuple)
return None
评论列表
文章目录