Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date getNearestFutureDateWithHour(int hourOfDay) { Calendar cal = Calendar.getInstance(); int hourOfDayNow = cal.get(Calendar.HOUR_OF_DAY); if (hourOfDayNow > hourOfDay) { cal.add(Calendar.DAY_OF_MONTH, 1); } cal.set(Calendar.HOUR, hourOfDay); return cal.getTime(); } }