Here you can find the source of parseDate(String representedValue)
private static Date parseDate(String representedValue) 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 final static String[] TIMEPATTERNS = { "yyyy-MM-ddtHH:mm:ss.SSXXX", "yyyy-MM-dd HH:mm:ss.SS X", "yyyy-MM-ddTHH:mm:ss.SX", "yyyy-MM-dd HH:mm:ss.SS", "yyyy-MM-dd" }; private static Date parseDate(String representedValue) throws ParseException { Date date = null;//from w ww . ja v a 2 s.co m for (final String pattern : TIMEPATTERNS) { try { date = new SimpleDateFormat(pattern).parse(representedValue); } catch (final Exception e) { // empty } if (date != null) { return date; } } return date; } }