How to get timezone from postal code using Java? - datetime

I have some Java code and I need to implement logic that finds timezone from postal code of UK region. Do we have any service that does the same.

All of the United Kingdom of Great Britain and Northern Ireland uses Europe/London time zone. Including Northern Ireland, Man, Jersey and Guernsey. So you just need ZoneId.of("Europe/London") always.
Link: List of tz database time zones

Related

HERE Traffic API: Does HERE provide data on accidents for Cape Town?

I'm using HERE Traffic API to get incident data, specifically data about accidents, for Cape Town.
Here is the link I'm using:
https://traffic.ls.hereapi.com/traffic/6.3/incidents.json?&apiKey=MY_API_KEY&bbox=-33.424531,18.208220;-34.398377,19.106580&type=Accident
which always yields a result such as:
{"TIMESTAMP": "08/26/2020 17:36:23 GMT", "VERSION": 2.4, "TIMESTAMP2": "2020-08-26T17:36:23.000+0000", "EXTENDED_COUNTRY_CODE": "NA"} - no accident is reported.
If I don't filter by the type of incident, i.e. using the link:
https://traffic.ls.hereapi.com/traffic/6.3/incidents.json?&apiKey=MY_API_KEY&bbox=-33.424531,18.208220;-34.398377,19.106580
I get data on other types of incidents and the "EXTENDED_COUNTRY_CODE" appears as D0 - as it should since it is the market code for South Africa (as per https://developer.here.com/documentation/traffic/dev_guide/topics/coverage-information.html).
Does the extended country code appear as NA when I filter by accident because HERE is not providing data on accidents for Cape Town? I've been able to filter the type of incident for other parts of the world so I guess there is no problem in how I am defining the link.
Many thanks in advance.
HERE does publish the accident data in South Africa. We also checked the data history internally, we do publish accident data for Cape Town.
I think when you get NA, mostly because there is no active accident at that time.
So far, we don't see any active accident event that has been missed but if you are aware of an active accident we missed please don't hesitate to let us know.

Some postcode searches returning inaccurate results

I'm using the Here Geocoder API using free-form input and getting random results when searching for postcodes in the Isle of Man.
I haven't tried all postcodes but the couple I have tested (from customer complaints) do appear to have a problem.
You can test the postcodes on the examples page and see the response yourself - https://developer.here.com/api-explorer/rest/geocoder
When searching for the postcode IM4 4LH the response returns an address for IP4 4LH but if you search for IM4 4 you get the right general area.
Another example is if you search for IM5 1HD you get the right response but if you search for IM51HD you instead get a response with IP5 1HD as the postcode.
IM4 4LH & IM5 1HD are legitimate postcode areas so I was wondering if there is something else we can do to more accurately target postcodes.
I know results could be more accurate with more search data but I would have thought a postcode on it's own would be more than enough.
Any help would be appreciated.
Thanks,
Jason
In the core map for United Kingdom and for Isle of Man only sector postal codes are available. E.g. " IM5 1".
The Geocoder additionally uses an extra product which provides the full postal codes (seven digits). Until last quarter they were covering only United Kingdom. E.g. postal code " IP5 1HD" is coming from these products.
Starting from this quarter it will cover also Isle of Man. This still need to be integrated into the Geocoder database. As soon as we are done, full postal codes will also be available for Isle of Man.
We work on it but cannot yet commit on a timeline.

WooCommerce - get Geo-IP location working for custom region/province

I have added Northern Ireland as a country to WooCommerce for shipping reasons. For those unfamiliar, Northern Ireland, along with the Republic of Ireland, makeup the island of Ireland but Northern Ireland is a member of the United Kingdom (a province of the UK I think is the official designation).
WooCommerce groups England, Scotland, Wales and Northern Ireland under the ISO 3166-1 code of GB / United Kingdom. It is a pain for handling shipping between RoI, NI and the UK mainland
So... I added Northern Ireland as a country in my store with the custom ISO code of "GB-NIR". While GB-NIR is a valid ISO 3166-2 code, WooCommerce recognises only ISO 3166-1 codes so geolocation / geo-IP doesn't work for visitors from Northern Ireland - e.g. the country field isn't automatically set to "Northern Ireland" at checkout, etc... I assume IP addresses from Northern Ireland visitors will mostly identify as UK IP addresses with the ISO code of "GB" and I wouldn't expect any IP database to utilise GB-NIR.
Is there anywhere I can say write a rule so that all IP addresses identifying as GB / United Kingdom are mapped in WooCommerce to my custom country of GB-NIR / Northern Ireland? United Kingdom isn't in use in my store (shipping to RoI and NI only, not UK mainland) so there's no issue shoehorning all UK IP addresses into Northern Ireland
Any thoughts how I might approach this?

Woocommerce shipping zone in the same country (UK) is not working

I tried using 3 zone of UK country, but if do search a specific postcode, it only shows the Mainland UK shipping method.
Example if I search a postcode near in Northern Ireland, I expected to see Standard Delivery shipping method only but Mainland UK shipping method is showing as always.
I'm missing something in the setup? or I setup it wrong?
Thanks guys ..
Drag Mainland UK as your last zone (before rest of the world).

Somaliland Country Abbreviation

I can't find a two letter country abbreviation for Somaliland, likely because it's not a country, but rather, as Wikipedia puts it: "an unrecognized self-declared de facto sovereign state that is internationally recognized as an autonomous region of Somalia". Nevertheless, it still takes up space on a map.
This may not seem like a programming question, but it is. I'm using the jvectormap jQuery plugin, which accounts for this region and has assigned it the abbreviation "_3" in lieu of a two letter abbreviation. The problem is that in order to make jvector map function correctly with my code, I need to enter Somaliland into our database but I don't want to use "_3" as its abbreviation, and I also don't want to just make something up.
First and foremost, is there an official two letter abbreviation for Somaliland?
As trivial and petty as this problem may sound, it's created a paradox in my mind and is causing my brain to melt. How can this be handled "correctly" if an official abbreviation does not exist?
The two-letter country code for Somalia is SO. ISO added it to ISO 3166 after it received the "UN notification of full name" in July 2013. See Somalia in ISO's Online Browsing Platform.
In the Country Codes Collection, SO has a green colour code for "Officially assigned code elements".
The ISO country codes collection does not have an entry for Somaliland. The Wikipedia article ISO 3166-2:SO (i.e. Somalia's country code) states - without citing a source -
The autonomous regions of Somaliland and Puntland (the former of which claims independence but is not recognized by any nation) each span several regions and have no separate codes.
Based on the ISO registry, this appears to be correct. jVectorMap gives Somaliland the code XS; in the ISO registry defines, two-letter codes starting with X are "User-assigned code elements". Using XS for Somaliland appears to be safe in the context of jVectorMap, but there is no guarantee that other libraries or programs will use the same two-letter code.
Somaliland is not listed by the Nations Online Project either.
After visiting Somaliland, the journalist Joshua Keating, writing in The Guardian of 20 July 2018:
(...), according to the US Department of State, the United Nations, the African Union and every other government on Earth, I was not in Somaliland, a poor but stable and mostly functional country on the Horn of Africa. I was in Somalia.
(...)
As Somalilanders will often remind you, it was, in the past, an independent country, fully recognised by the international community, including the UN. But this halcyon period lasted less than a week. On 26 June 1960, the former Protectorate of Somaliland became fully independent from British rule, its independence recognised by 35 countries around the world, including the US. The next day, its new legislature passed a law approving a union with the south. On 1 July, Somalia became independent from Italy, and the two were joined together. It is a decision Somaliland has regretted almost ever since.
See also
25 years on, Somaliland struggles for recognition by Deutsche Welle, August 2016.
Why Somaliland is not a recognised state by The Economist, November 2015.
Somaliland's own recognition campaign.

Resources