Here you can find the source of getStringToDateFull(String da)
public static Date getStringToDateFull(String da)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getStringToDateFull(String da) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null;//from w w w.j a v a 2s . c o m try { date = sdf.parse(da); } catch (ParseException e) { // TODO Auto-generated catch block try { sdf = new SimpleDateFormat("yyyy-MM-dd"); date = sdf.parse(da); } catch (ParseException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } } return date; } }