Here you can find the source of getDateFromString(String string)
public static Date getDateFromString(String string)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getDateFromString(String string) { try {//w ww.j av a2 s. c o m DateFormat m_ISO8601Local = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss"); return m_ISO8601Local.parse(string); } catch (ParseException e) { return new Date(System.currentTimeMillis()); } } }