【问题标题】:Python Arrow timezone parsingPython箭头时区解析
【发布时间】:2020-08-08 14:43:40
【问题描述】:

我正在尝试将字符串转换为 DateTime 对象,字符串:

Saturday 8th of August 2020 07:48:11 AM CDT

我正在使用箭头包

arrow.get('Saturday 8th of August 2020 09:23:34 AM CDT', 'dddd Mt[h] of MMMM YYYY HH:mm:ss A ZZZ')

我收到以下错误

arrow.parser.ParserError: Could not parse timezone expression "CDT"

我找不到任何将 CDN 部分转换为时区的方法。

【问题讨论】:

标签: python python-3.x datetime python-arrow


【解决方案1】:

在文档中已经说过,有些缩写是模棱两可的。例如,您可以使用 America/Chicago 而不是 CDT

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-21
    • 1970-01-01
    • 1970-01-01
    • 2018-10-31
    相关资源
    最近更新 更多