Here you can find the source of isInBetweenTimes(String startTime, String endTime)
public static boolean isInBetweenTimes(String startTime, String endTime)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static boolean isInBetweenTimes(String startTime, String endTime) { Date nowTime = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); String time = sdf.format(nowTime); if (time.compareTo(startTime) >= 0 && time.compareTo(endTime) <= 0) { return true; } else {//from ww w . j ava 2 s.c om return false; } } }