Here you can find the source of isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d)
public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d)
//package com.java2s; import java.util.*; public class Main { public static Calendar calendar = new GregorianCalendar(); /**// w ww.j a v a2s. c o m * Tells you if the date part of a datetime is in a certain time range. */ public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) { d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds()); if (start == null || end == null) { return false; } if (start.before(end) && (!(d.after(start) && d.before(end)))) { return false; } if (end.before(start) && (!(d.after(end) || d.before(start)))) { return false; } return true; } public static int getSeconds(Date date) { calendar.setTime(date); return calendar.get(Calendar.SECOND); } }