Here you can find the source of getHourAndMinutes(Date dt)
Parameter | Description |
---|---|
dt | The given Date |
public static String getHourAndMinutes(Date dt)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /**// www . j a va2 s. c o m * Get and return the hours and minutes from the given Date dt, ex: 11:30 * * @param dt * The given Date * * @return hrsMin The hours and minutes of date in format hh:mm */ public static String getHourAndMinutes(Date dt) { Calendar cal = new GregorianCalendar(); cal.setTime(dt); return (cal.get(Calendar.HOUR) + ":" + (cal.get(Calendar.MINUTE))); } }