Here you can find the source of compare2Date(Date date1, Date date2)
Parameter | Description |
---|---|
date1 | a parameter |
date2 | a parameter |
public static int compare2Date(Date date1, Date date2)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /****************************************************************************** * <date , date1>date2 return 0 ,date1==date2 return 1, date1<date2 * return 1; exception return -1;//ww w . j a v a 2 s .c o m * * @param date1 * @param date2 * @return */ public static int compare2Date(Date date1, Date date2) { try { if (date1.after(date2)) { return 0; } else if (date1.equals(date2)) { return 1; } else { return 2; } } catch (Exception e) { return -1; } } }