Java tutorial
//package com.java2s; //License from project: Apache License import android.text.TextUtils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static boolean isSameDay(String time) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String time1 = sdf.format(date); if (TextUtils.isEmpty(time)) { return false; } else if (time.equals(time1)) { return true; } return false; } public static boolean isSameDay(String time1, String time2) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { Date date1 = sdf.parse(time1); Date date2 = sdf.parse(time2); return sdf.format(date1).equals(sdf.format(date2)); } catch (ParseException e) { e.printStackTrace(); } return false; } }