Here you can find the source of parseDate(String dateString)
public static Date parseDate(String dateString)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 OSSMETER Partners. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/* w w w .j a va 2s .c o m*/ * Yannis Korkontzelos - Implementation. *******************************************************************************/ import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; public class Main { static SimpleDateFormat[] sdfList = new SimpleDateFormat[] { new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"), new SimpleDateFormat("dd MMM yyyy HH:mm:ss zzz"), new SimpleDateFormat("EEE, dd MMM yyyy HH:mm zzz (Z)"), new SimpleDateFormat("EEE, dd MMM yyyy HH:mm zzz"), new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss"), new SimpleDateFormat("dd MMM yyyy HH:mm:ss"), new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss Z"), new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy") }; public static Date parseDate(String dateString) { for (SimpleDateFormat sdf : sdfList) { ParsePosition ps = new ParsePosition(0); Date result = sdf.parse(dateString, ps); if (ps.getIndex() != 0) return result; } System.err.println("\t\t" + dateString + " cannot be parsed!\n"); return null; } }