Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { private static final Calendar calendar = Calendar.getInstance(); public static Date buildShiftStartTime(int startHour, int startMin, int startAmPm, int endHour, int endMin, int endAmPm) { startHour = startHour == 12 ? 0 : startHour; calendar.clear(); calendar.set(Calendar.HOUR, startHour); calendar.set(Calendar.MINUTE, startMin); calendar.set(Calendar.AM_PM, startAmPm); return calendar.getTime(); } }