【问题标题】:Python search custom European timePython搜索自定义欧洲时间
【发布时间】:2020-03-30 11:29:48
【问题描述】:

我正在尝试解析西班牙语字符串并从中获取日期时间。 有什么方法可以放需要搜索的日期格式吗?

from dateparser.search import search_dates

settings = {'DATE_ORDER': 'MDY'}

string = "26.03.2020 (datos consolidados a las 21:00 horas del 25.03.2020)"
time = search_dates(string, settings=settings)[-1]

print(time)

输出:

('21:00 horas del 25.03.2020', datetime.datetime(2020, 3, 26, 0, 0))

预期输出:

('21:00 horas del 25.03.2020', datetime.datetime(2020, 3, 25, 21, 0))

【问题讨论】:

    标签: python python-3.x dateparser


    【解决方案1】:

    使用dateparser.parse()date_formats 参数。

    【讨论】:

      猜你喜欢
      • 2020-09-01
      • 2014-02-09
      • 1970-01-01
      • 1970-01-01
      • 2011-07-23
      • 1970-01-01
      • 2021-03-21
      • 2017-03-24
      • 1970-01-01
      相关资源
      最近更新 更多