英文:
Golang parsing timestamp format
问题
我有一个解析 JSON 中时间戳的电报服务。
我在 JSON 消息中获取到的时间戳示例为:
2017-09-04T04:00:00
但是在电报设置中,我无法正确设置解析方式,我了解这是使用 Go 语言编写的。
time_format: "2006-01-02T15:04:05Z"
我遇到了一个错误:
ERROR: 格式"2006-01-02T15:04:05Z07:00"导致错误:将时间"2017-09-04T04:00:00"解析为"2006-01-02T15:04:05Z07:00"时出错:无法将""解析为"Z07:00"
但是我无法将其设置为正常工作。
英文:
I have a telegraph service that parses a timestamp in json.
I get this timestamp for example in json messages:
2017-09-04T04:00:00
But in the telegraph settings I can't set the parsing correctly, which I understand is in the go language.
time_format: "2006-01-02T15:04:05Z"
I am getting an error:
ERROR: format "2006-01-02T15:04:05Z07:00" resulted in error: parsing time "2017-09-04T04:00:00" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "Z07:00"
And somehow I can't set this to work.
答案1
得分: 3
你的时间布局包含一个时区组件,但你的时间没有。尝试使用以下布局:
"2006-01-02T15:04:05"
英文:
Your time layout includes a timezone component but your time doesn't. Try this layout:
"2006-01-02T15:04:05"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论