Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static Calendar toCalendar(String s, String format) { Calendar c = Calendar.getInstance(); SimpleDateFormat simpleDateFormat; simpleDateFormat = new SimpleDateFormat(format, Locale.getDefault()); s = s.replace("T", " "); // car T est invalide try { c.setTime(simpleDateFormat.parse(s)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return c; } }