Here you can find the source of isOverTime(Calendar lastTime, Calendar currentTime, Calendar begTime, Calendar endTime)
public static boolean isOverTime(Calendar lastTime, Calendar currentTime, Calendar begTime, Calendar endTime)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static boolean isOverTime(Date lastTime, Date currentTime, Date begTime, Date endTime) { return isOverTime(lastTime.getTime(), currentTime.getTime(), begTime.getTime(), endTime.getTime()); }// w w w . ja v a 2 s. co m public static boolean isOverTime(Calendar lastTime, Calendar currentTime, Calendar begTime, Calendar endTime) { return isOverTime(lastTime.getTimeInMillis(), currentTime.getTimeInMillis(), begTime.getTimeInMillis(), endTime.getTimeInMillis()); } public static boolean isOverTime(long lastTime, long currentTime, long begTime, long endTime) { boolean result = false; if ((lastTime != 0 && lastTime < begTime && currentTime >= begTime) || (lastTime >= begTime && currentTime >= endTime)) { result = true; } return result; } }