0

I'm trying to parse string on Spanish language and get datetime from it. Is any way to put date format that needs to be searched?

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)

Output:

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

Expected Output:

('21:00 horas del 25.03.2020', datetime.datetime(2020, 3, 25, 21, 0))
somal
  • 53
  • 1
  • 6

1 Answers1

0

Use the date_formats argument of dateparser.parse().

Gallaecio
  • 3,620
  • 2
  • 25
  • 64