Java Date Set setTime(final Date date, final int hourOfDay, final int minute, final int second)

Here you can find the source of setTime(final Date date, final int hourOfDay, final int minute, final int second)

Description

set Time

License

Open Source License

Declaration

public static Date setTime(final Date date, final int hourOfDay, final int minute, final int second) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static Date setTime(final Date date, final int hourOfDay, final int minute, final int second) {
        final GregorianCalendar gc = new GregorianCalendar();
        gc.setTime(date);/*from  w  w  w.  j a  v a  2s  .com*/
        gc.set(Calendar.HOUR_OF_DAY, hourOfDay);
        gc.set(Calendar.MINUTE, minute);
        gc.set(Calendar.SECOND, second);
        return gc.getTime();
    }
}

Related

  1. setStartDay(Date date)
  2. setStartTime(Date date)
  3. setTime(Date date, int hourOfDay, int minute, int second)
  4. setTime(Date date, int hours, int minutes, int seconds, int millis)
  5. setTime(Date date, String timeString)
  6. setTime(final Date date, final int hourOfDay, final int minute, final int second, final int ms)
  7. setTime(final Date date, final int hours, final int minutes, final int seconds)
  8. setTimeForDate(Date date, int h, int m, int s)
  9. setTimePart(Date date, String time, Integer milliseconds)