Here you can find the source of today()
public static Date today()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date today() { return clearTime(new Date()); }//from www . j a va 2 s .c om public static Date clearTime(Date date) { return parseDate(format(date)); } public static Date parseDate(String dateStr, String pattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); try { return sdf.parse(dateStr); } catch (Exception e) { return null; } } public static Date parseDate(String dateStr) { return parseDate(dateStr, "yyyy-MM-dd"); } public static String format(Date date, String pattern) { if (date == null) return ""; SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(date); } public static String format(Date date) { return format(date, "yyyy-MM-dd"); } }