Here you can find the source of parseDate(String text, String[] datePattern, int index)
private static boolean parseDate(String text, String[] datePattern, int index)
//package com.java2s; //License from project: LGPL import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { private static boolean parseDate(String text, String[] datePattern, int index) { if (index == datePattern.length) { return false; }/*from ww w . ja v a2 s. c om*/ SimpleDateFormat format = new SimpleDateFormat(datePattern[index]); format.setLenient(false); try { format.parse(text); return true; } catch (ParseException e) { return parseDate(text, datePattern, index + 1); } } }