Here you can find the source of parseToGregorianCalendar(String dateString)
public static GregorianCalendar parseToGregorianCalendar(String dateString) throws ParseException
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { public static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss"; public static final String GMT_TIMEZONE = "GMT"; public static GregorianCalendar parseToGregorianCalendar(String dateString) throws ParseException { DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_STRING); GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone(GMT_TIMEZONE)); calendar.setTime(dateFormat.parse(dateString)); return calendar; }/*from w w w . j a v a 2s .c om*/ }