Android Date Add dateByAddHoursAndMinutes(Date date, int hours, int minutes)

Here you can find the source of dateByAddHoursAndMinutes(Date date, int hours, int minutes)

Description

date By Add Hours And Minutes

License

Open Source License

Declaration

public static Date dateByAddHoursAndMinutes(Date date, int hours,
            int minutes) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date dateByAddHoursAndMinutes(Date date, int hours,
            int minutes) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(date.getTime());

        calendar.set(Calendar.HOUR_OF_DAY, hours);
        calendar.set(Calendar.MINUTE, minutes);

        Date dateFinal = new Date();
        dateFinal.setTime(calendar.getTimeInMillis());

        return dateFinal;
    }/*from  ww  w.j  a  va2  s .c o m*/
}

Related

  1. addWeeks(Date date, int amount)
  2. addWeeks(Date date, int amount)
  3. addYearToDate(Date date, int yearsToBeAdded)
  4. addYears(Date date, int amount)
  5. addYears(Date date, int amount)
  6. getDateAdd(Date date, int amount)
  7. addDaysToDate(Date date, int days)
  8. addTimeInterval(Date origin, int value, int unit)