Problem in getting time of different time zone
TimeZone timeZone1 = TimeZone.getTimeZone("America/Los_Angeles");
TimeZone timeZone2 = TimeZone.getTimeZone("Europe/Copenhagen");
Calendar calendar = new GregorianCalendar(timeZone1);
System.out.println("Time in LA: "+calendar.getTime());
I run this code but it is not working and giving me the current time in current time zone.
Re: Problem in getting time of different time zone
You might find a solution by studying the Calendar API. I'm not sure what you mean by "the current time in the current time zone," but you might try getting a Calendar instance specifying the time zone, locale, or both.