This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Below you may find a code snippet which is called from a main method where I would like to display the time as per the country code. Somehow it is displaying the current system time but not the time in USA. I am testing from Hungary.
Then you are going to have to do what Rok suggested. For each country go through that list and identify the time zone it uses. Then make a map from country code to time zone, and use that.
I already explained why your original idea wouldn't work. And because it won't work for a considerable number of countries, there would be no point in trying to implement it for the rest. What would it do for a country with several time zones? Throw an exception? Pick one time zone at random? Whatever it did wouldn't be of any use. So there's no point in doing that. So people didn't.