Here you can find the source of stringToDate(String s, String format)
public static Date stringToDate(String s, String format) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date stringToDate(String s, String format) throws ParseException { return new SimpleDateFormat(format).parse(s); }/*from w w w .j a v a 2 s .c om*/ }