Here you can find the source of ParseDate(String string, String format)
static private Date ParseDate(String string, String format)
//package com.java2s; import java.util.*; import java.text.SimpleDateFormat; import java.text.ParseException; public class Main { /** Tries to parse string into a Date(+time), using given format. * @return null if parsing fails//w w w . j a va2s. c om */ static private Date ParseDate(String string, String format) { try { return new SimpleDateFormat(format).parse(string); } catch (ParseException exc) { } // OK, 'expected' exception return null; } }