Create an instance using Japan's time zone and set it with the local UTC : Calendar « I18N « Java






Create an instance using Japan's time zone and set it with the local UTC

  

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class Main {
  public static void main(String[] argv) throws Exception {
    Calendar local = Calendar.getInstance();
    Calendar japanCal = new GregorianCalendar(TimeZone.getTimeZone("Japan"));
    japanCal.setTimeInMillis(local.getTimeInMillis());
  }
}

   
    
  








Related examples in the same category

1.Locales for CalendarLocales for Calendar
2.Calendar Manipulation for I18N (Internationalization)Calendar Manipulation for I18N (Internationalization)
3.Get the foreign time
4.Given a time of 10am in Japan, get the local time