Here you can find the source of isNowDay(String d)
public static boolean isNowDay(String d)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static final String DATE_FORMAT = "yyyy/MM/dd"; public static boolean isNowDay(String d) { boolean flg = false; SimpleDateFormat sd = new SimpleDateFormat(DATE_FORMAT); String nowDate = sd.format(new Date()); try {// w ww .ja va2 s. c o m d = sd.format(sd.parse(d)); if (d.equals(nowDate)) { flg = true; } } catch (ParseException e) { e.printStackTrace(); } return flg; } public static String format(Date d, String format) { return format(d, format, Locale.getDefault()); } public static String format(Date d, String format, Locale locale) { if (d == null) return ""; DateFormat df = new SimpleDateFormat(format, locale); return df.format(d); } }