Java TimeZone create from String as "GMT+05:30"

Description

Java TimeZone create from String as "GMT+05:30"

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

public class Main {
  public static void main(String[] args) {
     // Get Indian time zone, which is GMT+05:30
     TimeZone indianTZ = TimeZone.getTimeZone("GMT+05:30");
     GregorianCalendar indianDate = new GregorianCalendar(indianTZ);
     System.out.println(indianDate.getTime());
  }/*from   w ww . j  av a2 s.  c  om*/

}



PreviousNext

Related