Java Utililty Methods Date to Minute

List of utility methods to do Date to Minute

Description

The list of methods to do Date to Minute are organized into topic(s).

Method

intgetMinuteOfHour(final Date date)
Get the minute within the hour by given date.
E.g.: at 10:04:15.250 PM the MINUTE is 4.
return getNumberOfGranularity(Calendar.MINUTE, date);
intgetMinutes(Date d)
get Minutes
Calendar c = getCalendar();
c.setTime(d);
return (c.get(Calendar.MINUTE));
intgetMinutes(Date time)
Returns the minutes from midnight for the specified time.
Calendar calendar = Calendar.getInstance();
calendar.setTime(time);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int mins = calendar.get(Calendar.MINUTE);
return (hour * 60) + mins;
intgetMinutes(final Date date)
The Method from the Date.getMinutes is deprecated.
final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.MINUTE);
intgetMinutesInDay(Date d)
get Minutes In Day
c1.setTime(d);
return c1.get(Calendar.HOUR_OF_DAY) * 60 + c1.get(Calendar.MINUTE);
intgetMinutesOfHour(Date dt)
Get and return the minutes of the hour from the given Date dt
Calendar cal = new GregorianCalendar();
cal.setTime(dt);
return (cal.get(Calendar.MINUTE));
intminute(Date date)
minute
return dateField(date, Calendar.MINUTE);
intminute(final Date date)
minute
return fromDateToCalendar(date).get(MINUTE);
DateminuteAdd(Date date, int val)
minute Add
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MINUTE, val);
date = calendar.getTime();
return date;
DateminuteDate(Date date, int num)
minute Date
Calendar now = Calendar.getInstance();
now.setTime(date);
int year = now.get(Calendar.YEAR);
int month = now.get(Calendar.MONTH);
int day = now.get(Calendar.DAY_OF_MONTH);
now.set(year, month, day);
now.add(Calendar.MINUTE, num);
return now.getTime();
...