Java Date Set setHour(java.util.Date date, Integer hour)

Here you can find the source of setHour(java.util.Date date, Integer hour)

Description

set Hour

License

Open Source License

Declaration

public static java.util.Date setHour(java.util.Date date, Integer hour) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static java.util.Date setHour(java.util.Date date, Integer hour) {
        java.util.Calendar cal = Calendar.getInstance();
        cal.setTime(date);//from w w  w . ja  v  a  2s  .c  o  m
        cal.set(Calendar.HOUR, hour);
        return cal.getTime();
    }
}

Related

  1. setDateSecond(Date dateParam, int second)
  2. setDateToDayStart(final Date date)
  3. setDateToStartOfDay(Date date)
  4. setDayStart(final Date date)
  5. setField(Date date, int field, int value)
  6. setHourMinuteSecondToZeroPlus24Hours(Date datetime)
  7. setHours(Date d, int hours)
  8. setHours(Date date, int amount)
  9. setMilliSecondsToDate(Date date, Integer milliSeconds)