Java tutorial
//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 { date = sd.parse(dateString); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return date; } }