GregorianCalendar Class in Java
问题 I am trying to get current time in other time zone. I used this code for this: GregorianCalendar calender = new GregorianCalendar(TimeZone.getTimeZone("Asia/Bangkok")); System.out.println(calender.getTime()); But, when I am running this code, this code provides the current time in CET as the time in my local machine is in CET. I am confused. Then why there is scope to provide a TimeZone in constructor? 回答1: Ahh, the joys of the Java Date/Time API ... What you want (aside from a better API,