Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static Calendar getMorningCal(int hour, int minute) { Calendar c = Calendar.getInstance(); if (c.get(Calendar.HOUR_OF_DAY) > 3) { //next day c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) + 1); } c.set(Calendar.HOUR_OF_DAY, hour); c.set(Calendar.MINUTE, minute); c.set(Calendar.SECOND, 0); return c; } }