Here you can find the source of StringToDate(String format, String dateStr)
public static Date StringToDate(String format, String dateStr)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date StringToDate(String format, String dateStr) { SimpleDateFormat dateFormat = new SimpleDateFormat(format); try {// www.j a v a 2 s. com Date date = dateFormat.parse(dateStr.trim()); return date; } catch (Exception e) { e.printStackTrace(); } return null; } }