Here you can find the source of isToday(Date date)
public static boolean isToday(Date date)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { /**//from www. jav a 2 s .co m * Default date format */ public static final String DATE_FORMAT = "yyyy-MM-dd"; public static boolean isToday(Date date) { if (date == null) { return false; } String dateAsText = toDateText(date); String todayAsText = toDateText(now()); return dateAsText.equals(todayAsText); } public static String toDateText(Date date) { return toDateText(date, DATE_FORMAT); } public static String toDateText(Date date, String pattern) { if (date == null || pattern == null) { return null; } DateFormat dateFormat = createDateFormat(pattern); return dateFormat.format(date); } public static Date now() { return new Date(); } private static DateFormat createDateFormat(String pattern) { return new SimpleDateFormat(pattern, Locale.SIMPLIFIED_CHINESE); } }