Here you can find the source of convertToDateTime(java.util.Date date, String time)
public static Date convertToDateTime(java.util.Date date, String time) throws ParseException
//package com.java2s; import java.sql.Date; import java.text.ParseException; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.StringTokenizer; public class Main { public static Date convertToDateTime(java.util.Date date, String time) throws ParseException { Calendar calendar = new GregorianCalendar(); String[] timeArray = getTime(time); calendar.setTime(date);/*from w w w . j av a 2 s .c om*/ calendar.set(Calendar.HOUR, Integer.parseInt(timeArray[0])); calendar.set(Calendar.MINUTE, Integer.parseInt(timeArray[1])); return new Date(calendar.getTime().getTime()); } private static String[] getTime(String time) { String[] timeArray = new String[2]; StringTokenizer tc = new StringTokenizer(time, ":"); // Hour timeArray[0] = tc.nextToken(); // Minute timeArray[1] = tc.nextToken(); return timeArray; } }