简体   繁体   English

Python的时间字符串格式是什么?

[英]What is the Python time string format for this?

I am trying to find the correct time format for this time string for the Python time module: 我正在尝试为Python时间模块的此时间字符串找到正确的时间格式:

'2019-01-25T06:59:36.8081116Z'

I tried this '%Y-%m-%dT%H:%M:%SZ' and many variants and can't get it right. 我尝试了这个'%Y-%m-%dT%H:%M:%SZ'和许多变体,但无法正确解决。

Link to the documentation: https://docs.python.org/2/library/time.html 链接到文档: https : //docs.python.org/2/library/time.html

This might help 这可能有帮助

import datetime
curtime = datetime.datetime.now()
curtime.strftime("%Y-%m-%dT%H:%M:%S.%fZ")

couldn't figure out how to get 7 decimal places. 无法弄清楚如何获得小数点后7位。 Maybe your string ends with '6Z' instead of 'Z'? 也许您的字符串以“ 6Z”而不是“ Z”结尾?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM