Here you can find the source of parseHttpDate(String _dateStr)
public static java.util.Date parseHttpDate(String _dateStr)
//package com.java2s; /* //from www . ja v a 2 s . co m * Copyright (C) 2012 AW2.0 Ltd * * org.aw20 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * Free Software Foundation,version 3. * * OpenBD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with org.aw20. If not, see http://www.gnu.org/licenses/ * * Additional permission under GNU GPL version 3 section 7 * * If you modify this Program, or any covered work, by linking or combining * it with any of the JARS listed in the README.txt (or a modified version of * (that library), containing parts covered by the terms of that JAR, the * licensors of this Program grant you additional permission to convey the * resulting work. * * $Id: FileUtil.java 2981 2012-08-08 21:01:27Z alan $ */ import java.text.DateFormat; import java.text.ParsePosition; import java.text.SimpleDateFormat; public class Main { public static java.util.Date parseHttpDate(String _dateStr) { if (_dateStr == null) return null; int c1 = _dateStr.lastIndexOf(" "); if (c1 != -1) _dateStr = _dateStr.substring(0, c1).trim(); return parseDate(_dateStr, "EEE, d MMM yyyy HH:mm:ss"); } public static java.util.Date parseDate(String sDate, String _datePattern) { sDate = (sDate != null) ? sDate.trim() : null; /* if the date is null or empty, no point in going forward */ if (sDate == null || sDate.length() == 0) return null; ParsePosition pp; java.util.Date d = null; DateFormat df = new SimpleDateFormat(_datePattern); df.setLenient(false); try { pp = new ParsePosition(0); d = df.parse(sDate, pp); if (pp.getIndex() != sDate.length()) { d = null; } } catch (Exception ex1) { return null; } return d; } }