Java Parse Date parseDate(final String revision)

Here you can find the source of parseDate(final String revision)

Description

parse Date

License

Open Source License

Declaration

public static Date parseDate(final String revision) 

Method Source Code


//package com.java2s;
/*//w  w w .  j  a va 2  s .  c  om
 * Copyright (c) 2014 Cisco Systems, Inc. and others.  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
 */

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static Date parseDate(final String revision) {
        final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        try {
            return formatter.parse(revision);
        } catch (final ParseException e) {
            throw new IllegalArgumentException("Date not valid", e);
        }
    }
}

Related

  1. parseDate(final String date, final List patterns)
  2. parseDate(final String date, final String format)
  3. parseDate(final String dateStr)
  4. parseDate(final String dateString)
  5. parseDate(final String pDate)
  6. parseDate(final String source)
  7. parseDate(final String source)
  8. parseDate(final String str)
  9. parseDate(final String str, final Locale locale, final String... parsePatterns)