Here you can find the source of dayFilter(Date date)
public static Date dayFilter(Date date)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String _8DIGIT_DATE_1 = "yyyy/MM/dd"; public static Date dayFilter(String text) { SimpleDateFormat format = new SimpleDateFormat(_8DIGIT_DATE_1); try {/*from w ww . j a va 2 s .co m*/ return format.parse(text); } catch (ParseException e) { e.printStackTrace(); } return new Date(); } public static Date dayFilter(Date date) { SimpleDateFormat format = new SimpleDateFormat(_8DIGIT_DATE_1); return dayFilter(format.format(date)); } public static Date parse(String text, String type) throws ParseException { SimpleDateFormat format = new SimpleDateFormat(type); return format.parse(text); } public static String format(Date aDate, String type) { SimpleDateFormat sdf = new SimpleDateFormat(type); return sdf.format(aDate); } public static String format(Long dateMs, String type) { Date date = new Date(dateMs); SimpleDateFormat sdf = new SimpleDateFormat(type); return sdf.format(date); } }