Java Day Compare isSameDay(Date date1, Date date2)

Here you can find the source of isSameDay(Date date1, Date date2)

Description

is Same Day

License

LGPL

Declaration

public static boolean isSameDay(Date date1, Date date2) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static boolean isSameDay(Date date1, Date date2) {
        return date2String(date1, "yyyy-MM-dd").equals(date2String(date2, "yyyy-MM-dd"));
    }/* w  w  w  .j av  a 2  s  .c o m*/

    public static String date2String(Date date, String format) {

        SimpleDateFormat df = new SimpleDateFormat(format);
        return df.format(date);
    }
}

Related

  1. isSameDay(Date c1, Date c2)
  2. isSameDay(Date date, Date date2)
  3. isSameDay(Date date1, Date date2)
  4. isSameDay(Date date1, Date date2)
  5. isSameDay(Date date1, Date date2)
  6. isSameDay(Date date1, Date date2)
  7. isSameDay(Date date1, Date date2)
  8. isSameDay(Date day1, Date day2)
  9. isSameDay(Date day1, Date day2)