Here you can find the source of toDate(String dateString)
public static Date toDate(String dateString) throws ParseException
//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; import java.util.TimeZone; public class Main { public static Date toDate(String dateString) throws ParseException { DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); format.setTimeZone(TimeZone.getTimeZone("UTC")); return format.parse(dateString); }//from ww w .j a v a 2 s.c o m }