Here you can find the source of isToday(String sdate)
public static boolean isToday(String sdate)
//package com.java2s; //License from project: LGPL import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { private final static SimpleDateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private final static SimpleDateFormat dateFormater2 = new SimpleDateFormat("yyyy-MM-dd"); public static boolean isToday(String sdate) { boolean b = false; Date time = toDate(sdate); Date today = new Date(); if (time != null) { String nowDate = dateFormater2.format(today); String timeDate = dateFormater2.format(time); if (nowDate.equals(timeDate)) { b = true;/*from w ww . j a v a2s .c o m*/ } } return b; } public static Date toDate(String sdate) { try { return dateFormater.parse(sdate); } catch (ParseException e) { return null; } } }