I want to get local time of different time zones using Java code. Based on the time zone passed to the function I need that time zone's local time. How to achieve this?
java.util.TimeZone tz = java.util.TimeZone.getTimeZone("GMT+1"); java.util.Calendar c = java.util.Calendar.getInstance(tz); System.out.println(c.get(java.util.Calendar.HOUR_OF_DAY)+":"+c.get(java.util.Calendar.MINUTE)+":"+c.get(java.util.Calendar.SECOND));
2.1m questions
2.1m answers
60 comments
57.0k users