Here you can find the source of compare(Calendar c1, Calendar c2)
Parameter | Description |
---|---|
c1 | First calendar. |
c2 | Second calendar |
public static int compare(Calendar c1, Calendar c2)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { /**/*from ww w. j ava 2s . c om*/ * Compare to calendars. * * @param c1 First calendar. * @param c2 Second calendar * @return 1 if c1 > c2, 0 if c1 = c2, -1 if c1 < c2. */ public static int compare(Calendar c1, Calendar c2) { long m1 = c1.getTime().getTime(); long m2 = c2.getTime().getTime(); if (m1 < m2) { return -1; } if (m1 > m2) { return 1; } return 0; } }