Here you can find the source of toDate(String str)
public static Date toDate(String str) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.util.Date; public class Main { public static Date toDate(String str) throws ParseException { Date date = DateFormat.getDateInstance().parse(str); return date; }/*from ww w .j a va 2 s .c o m*/ }