Here you can find the source of asDate(String date)
Parameter | Description |
---|
Parameter | Description |
---|---|
ParseException | an exception |
public static Date asDate(String date)
//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; } } }