1 public Date toDay(String date) {
2 DateFormat dateFormat=null;
3 dateFormat = new SimpleDateFormat("yyyy-MM-dd");
4 // dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
5 dateFormat.setLenient(false);
6 try {
7 Date day = dateFormat.parse(date);
8 return day;
9 } catch (Exception e) {
10 e.printStackTrace();
11 return null;
12 }
13 }
14