Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static SimpleDateFormat defaultTimeFormat = new SimpleDateFormat("HH:mm"); public static String updateCalendarTimeAndGetFormat(Calendar cal, int hourOfDay, int minute) { cal.set(Calendar.HOUR_OF_DAY, hourOfDay); cal.set(Calendar.MINUTE, minute); return defaultTimeFormat.format(cal.getTime()); } }