I have a GMT datetime:
import datetime, pytz
d = datetime.datetime(2020, 11, 27, 12, 0, 0)
Given a "country+sate" or "country+city" pair (when state is not available), or even better, with an ISO 3166 two-part code or a cityId
like this:
#case 1
country, state = 'US', 'CA'
#case 2
country, city = 'RU', 'Nowosibirsk' # here no information of "State" is given
#case 3
iso = 'FR-ARA' # France, Region Auvergne-Rhone-Alpes
#case 4
cityId = '1003854' # Germany, Berlin, dataset here: https://developers.google.com/adwords/api/docs/appendix/geo/geotargets-2020-11-18.csv
how to find the local timezone, and get the local datetime?
I know pytz
can be useful, but obviously not all cities are listed in it (and even if it's the case, the spelling can vary, see here for the city I mentioned on case #2).
What are usual solutions for this timezone problem?