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

Apache License

Declaration

public static boolean isSameDay(Date date1, Date date2) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public final static String webFormat = "yyyy-MM-dd";

    public static boolean isSameDay(Date date1, Date date2) {
        SimpleDateFormat sdf = new SimpleDateFormat(webFormat);
        return sdf.format(date1).equals(sdf.format(date2));
    }//from w w w .ja v a2 s .c om

    public static String format(Date date, String format) {
        if (date == null) {
            return null;
        }

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

Related

  1. compareDay(Date first, Date second)
  2. compareInSameDay(Date date1, Date date2)
  3. isSameDay(Date a, Date b)
  4. isSameDay(Date c1, Date c2)
  5. isSameDay(Date date, Date date2)
  6. isSameDay(Date date1, Date date2)
  7. isSameDay(Date date1, Date date2)
  8. isSameDay(Date date1, Date date2)
  9. isSameDay(Date date1, Date date2)