3
Error :  UnknownTimezoneWarning: tzname IST identified but not understood.  Pass `tzinfos` argument in order to correctly return a timezone-aware datetime.  In a future version, this will raise an exception.
  category=UnknownTimezoneWarning)

I'm using datefinder for getting the date out of a string.

This is a sample code:

import datefinder

a =  'Last Updated :16th July 2020 18:00 IST'
matches = list(datefinder.find_dates(a, source = True ))
print (matches)

Output :

UnknownTimezoneWarning: tzname IST identified but not understood.  Pass `tzinfos` argument in order to correctly return a timezone-aware datetime.  In a future version, this will raise an exception.
  category=UnknownTimezoneWarning)
[(datetime.datetime(2020, 7, 16, 18, 0), '16th July 2020 18:00 IST')]

How can I eliminate the above error? (It works fine while using UTC in the string 'a' in place of IST(Indian Standard Time))

Dark Shadow
  • 39
  • 1
  • 6
  • Take a look at the following at the following link where they discuss how to address the above error you are having https://stackoverflow.com/questions/51206500/how-to-convert-a-string-datetime-with-unknown-timezone-to-timestamp-in-python – Akib Rhast May 28 '20 at 13:38
  • Yeah I've read this article. But I'm using `datefinder` not `dateutil`. How to deal with this error in datefinder? – Dark Shadow May 28 '20 at 17:54
  • datefinder is using the dateutil library internally – Akib Rhast May 28 '20 at 18:22
  • If you change a = 'Last Updated :16th July 2020 18:00 IST' , the string to this: a = 'Last Updated :16th July 2020 18:00 UTC-5.5' . it should hopefullt work – Akib Rhast May 28 '20 at 18:42
  • Does this answer your question? [how to convert a string datetime with unknown timezone to timestamp in python](https://stackoverflow.com/questions/51206500/how-to-convert-a-string-datetime-with-unknown-timezone-to-timestamp-in-python) – guerda Jun 02 '22 at 14:19

0 Answers0