Java: timezone shift / Zeit in andere Zeitzone umrechnen

To calculate a time to another time zone, just

  1. get a timezone object for the new timezone
  2. register the timezone object to a formatter
  3. recalculate the time with the formatter to a string

code sample:

// formatter
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
// local date
Date now = new Date();
// instanciate timezone
TimeZone timezone = TimeZone.getTimeZone(„Japan“);
// register on formatter
// recalculate
System.out.println(„Japan time is:“+df.format(now));