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

Description

The following code shows how to create an instance using Japan's time zone and set it with the local UTC.

Example


/*from   ww  w .  j a  v  a2 s  . c  o m*/
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());
  }
}




















Home »
  Java Tutorial »
    Date »




Date Get
Date Set
Date Format
Date Compare
Date Convert
Date Calculation
Date Parse
Timezone