Here you can find the source of getCalendarFromDates(Date date, Date hourMinuteMillisseconds)
Parameter | Description |
---|---|
date | Date object containing the date - doesn't matter hour, minute, second and millisseconds values. |
hourMinuteMillisseconds | Date object containing hour, minute, second and millisseconds. Doesn't matter date values. |
public static final Calendar getCalendarFromDates(Date date, Date hourMinuteMillisseconds)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /**//w w w . ja v a2 s .c om * Merge two Date variables to compose a single Calendar object. * * @param date * Date object containing the date - doesn't matter hour, minute, * second and millisseconds values. * @param hourMinuteMillisseconds * Date object containing hour, minute, second and millisseconds. * Doesn't matter date values. * @return a Calendar object */ public static final Calendar getCalendarFromDates(Date date, Date hourMinuteMillisseconds) { Calendar ret = Calendar.getInstance(); ret.setTime(date); Calendar hour = Calendar.getInstance(); hour.setTime(hourMinuteMillisseconds); ret.set(Calendar.HOUR_OF_DAY, hour.get(Calendar.HOUR_OF_DAY)); ret.set(Calendar.MINUTE, hour.get(Calendar.MINUTE)); ret.set(Calendar.SECOND, hour.get(Calendar.SECOND)); ret.set(Calendar.MILLISECOND, hour.get(Calendar.MILLISECOND)); return ret; } }