Here you can find the source of toDateFromString(String dateString)
public static Date toDateFromString(String dateString)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date toDateFromString(String dateString) { // 1985-04-12T23:20:50.52Z SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a"); // sd.setTimeZone(TimeZone.getDefault()); Date date = new Date(); try {//from w w w. j a va 2 s .c o m date = sd.parse(dateString); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return date; } }