import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import android.util.Log;
class Main {
final static String ISO8601DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSZ";
/**
* Generate a Calendar from ISO 8601 date
*
* @param date
* a ISO 8601 Date string
* @return a Calendar object
*/
public static Calendar getCalendarFromISO(String datestring) {
Calendar calendar = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()) ;
SimpleDateFormat dateformat = new SimpleDateFormat(ISO8601DATEFORMAT, Locale.getDefault());
try {
Date date = dateformat.parse(datestring);
date.setHours(date.getHours()-1);
calendar.setTime(date);
} catch (ParseException e) {
e.printStackTrace();
}
return calendar;
}
}