Here you can find the source of parseDate(String line)
public static Date parseDate(String line)
//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 parseDate(String line) { if (!isLogEntryStart(line)) { return null; }/*from w w w . ja v a2s . c o m*/ SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS"); try { return parser.parse(line.substring(0, 23)); } catch (ParseException e) { return null; } } public static boolean isLogEntryStart(String line) { // TEMPORARY return line != null && line.length() >= 23 && line.startsWith("201") && line.charAt(4) == '-' && line.charAt(7) == '-' && line.charAt(10) == ' ' && line.charAt(13) == ':' && line.charAt(16) == ':' && line.charAt(19) == ','; } }