Here you can find the source of dateIsBetweenTwoDates(String begin, String end)
public static boolean dateIsBetweenTwoDates(String begin, String end)
//package com.java2s; import java.util.Calendar; public class Main { public static boolean dateIsBetweenTwoDates(String begin, String end) { String[] splitBeginStr = begin.split(":"); int hrBegin = Integer.parseInt(splitBeginStr[0]); int minBegin = Integer.parseInt(splitBeginStr[1]); String[] splitEndStr = end.split(":"); int hrEnd = Integer.parseInt(splitEndStr[0]); int minEnd = Integer.parseInt(splitEndStr[1]); Calendar beginCal = Calendar.getInstance(); beginCal.set(Calendar.HOUR_OF_DAY, hrBegin); beginCal.set(Calendar.MINUTE, minBegin); Calendar endCal = Calendar.getInstance(); endCal.set(Calendar.HOUR_OF_DAY, hrEnd); endCal.set(Calendar.MINUTE, minEnd); Calendar currentCal = Calendar.getInstance(); if (beginCal.before(currentCal) && currentCal.before(endCal)) { return true; }//from w ww.j av a2 s. c o m return false; } }