Java SQL Date Get getDateWithSpecifiedHourAndMinute(Date targetDate, int hour, int minute)

Here you can find the source of getDateWithSpecifiedHourAndMinute(Date targetDate, int hour, int minute)

Description

get Date With Specified Hour And Minute

License

Apache License

Declaration

public static Timestamp getDateWithSpecifiedHourAndMinute(Date targetDate, int hour, int minute) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;

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

public class Main {

    public static Timestamp getDateWithSpecifiedHourAndMinute(Date targetDate, int hour, int minute) {
        Calendar c = Calendar.getInstance();
        c.setTime(targetDate);/*w w w.  j a  va  2 s . c om*/
        c.set(Calendar.HOUR_OF_DAY, hour);
        c.set(Calendar.MINUTE, minute);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        return new Timestamp(c.getTimeInMillis());
    }
}

Related

  1. getDatePath(java.util.Date fileDate)
  2. getDateStart(Date date)
  3. getDateTwo(Date date)
  4. getDateValue(ResultSet result, String strField, String strDateFormat)
  5. getDateValue(ResultSet result, String strField, String strDateFormat)
  6. getDateYYMM(java.sql.Timestamp ts)