Here you can find the source of parse(String stringData)
public static Date parse(String stringData)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date parse(String stringData) { final DateFormat fmt; if (stringData.endsWith("Z")) { fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); } else {//from www . j a v a2 s. com fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); } try { return fmt.parse(stringData); } catch (ParseException e) { e.printStackTrace(); } return null; } }