Here you can find the source of parseDate(String date)
public static Date parseDate(String date) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ssZ"; private static String DATE_FORMAT_STRING_WITHOUT_TZ = "yyyy-MM-dd'T'HH:mm:ss"; public static String parseDate(final Date date) throws ParseException { return new SimpleDateFormat(DATE_FORMAT_STRING).format(date); }//from ww w . j ava 2s . co m public static Date parseDate(String date) throws ParseException { if (date.endsWith("Z")) { date = date.substring(0, date.length() - 1); } if (date.length() == 10) { date = date + "T00:00:00"; } date = date.replaceAll("^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})$", "$1-$2-$3T$4:$5:$6"); date = date.replaceAll("^(\\d{4})(\\d{2})(\\d{2})$", "$1-$2-$3T00:00:00"); return new SimpleDateFormat(DATE_FORMAT_STRING_WITHOUT_TZ).parse(date); } }