That information is excellent. It gives lat./long., so one could use weather.com to get the timezone abbreviation. But it also gives the timezone name in a format that can be used with the table look-up discussed earlier in this thread. Finally, it also gives the utc_offset. So now both options are available, abbreviation or offset (or both). And the full timezone name is available from SysInfo, the only problem being with that string containing the country name at the beginning (which I guess is a Windows issue, since I suppose SysInfo is just returning what the O/S gives it?).I think you want this for auto-detecting the latitude and longitude:
https://ipapi.co/json
Pretty easy to parse...This will detect the location of your ISP, so it's marginal for a weather skin in my OCD view, but certainly close enough for Time Zone...Code:
{ "ip": "68.100.86.32", "network": "68.100.64.0/18", "version": "IPv4", "city": "Fairfax", "region": "Virginia", "region_code": "VA", "country": "US", "country_name": "United States", "country_code": "US", "country_code_iso3": "USA", "country_capital": "Washington", "country_tld": ".us", "continent_code": "NA", "in_eu": false, "postal": "22036", "latitude": 38.7351, "longitude": -77.0797, "timezone": "America/New_York", "utc_offset": "-0400", "country_calling_code": "+1", "currency": "USD", "currency_name": "Dollar", "languages": "en-US,es-US,haw,fr", "country_area": 9629091, "country_population": 327167434, "asn": "AS22773", "org": "ASN-CXA-ALL-CCI-22773-RDC"}
Note that if you are using a VPN and spoofing your location to somewhere in Lower Slobovia, your milage will vary.
Your code in the following post also works well, giving all the information (apart from timezone abbreviation) right from SysInfo. (I'm still working on understanding that code. I use regex so extremely rarely, that every time I do, I need to learn it over again. )
It would be nice to know how to eliminate that country name in the timezone name, in a portable fashion. However, for me right now that is just curiosity, since I hadn't planned on using the full name anyway, just the abbreviation or maybe the offset, or possibly both.
Statistics: Posted by qwerky — Today, 5:59 pm