Here you can find the source of mergeDateTime(Calendar date, Calendar time)
public static Calendar mergeDateTime(Calendar date, Calendar time)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static Calendar mergeDateTime(Calendar date, Calendar time) { Calendar clendar = null;// www . ja va2 s. c o m if (date != null && time != null) { clendar = Calendar.getInstance(); clendar.set(Calendar.YEAR, date.get(Calendar.YEAR)); clendar.set(Calendar.MONTH, date.get(Calendar.MONTH)); clendar.set(Calendar.DAY_OF_MONTH, date.get(Calendar.DAY_OF_MONTH)); // clendar.set(Calendar.HOUR_OF_DAY, time.get(Calendar.HOUR_OF_DAY)); clendar.set(Calendar.MINUTE, time.get(Calendar.MINUTE)); clendar.set(Calendar.SECOND, time.get(Calendar.SECOND)); clendar.set(Calendar.MILLISECOND, time.get(Calendar.MILLISECOND)); } return clendar; } }