I Looking for a method that convert time string into Calendar look like this:
public static Calendar stringToCalendar(String strDate, TimeZone timezone){
String FORMAT_DATETIME = "yyyy-MM-dd'T'HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATETIME);
sdf.setTimeZone(timezone);
Date date = sdf.parse(strDate);
Calendar cal = Calendar.getInstance(timezone);
cal.setTime(date);
return cal;
}
This code above does not work.
For example: when I pass time string '2012-05-08T09:10:10' with pattern yyyy-MM-dd'T'HH:mm:ss and Timezone is GMT+7, the result (from Calendar object) should be: 2012-05-08T16:10:10
The problem is for some reasons, I don't want to use Joda time. So, how can I do this?