Java Date Parse asDate(String date)

Here you can find the source of asDate(String date)

Description

as Date

License

Open Source License

Parameter

Parameter Description

Exception

Parameter Description
ParseException an exception

Return

converted to Date

Declaration

public static Date asDate(String date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
            "dd.MM.yyyy", Locale.GERMANY);

    /**/*from  w ww.  j a  v a2s. c  om*/
     * @param DD.MM.YYYY, e.G. 15.03.2001 as Text
     * @return converted to Date
     * @throws ParseException 
     */
    public static Date asDate(String date) {
        try {
            return DATE_FORMAT.parse(date);
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. asDate(Date date, String format)
  2. asDate(final long time)
  3. asDate(final Map map, final String key)
  4. asDate(final String literal)
  5. asDate(String param, SimpleDateFormat format)
  6. asDate(String s)
  7. asDate(String string)
  8. asDate(String value, String format)