Java Timestamp resetHourMinuteSecond(Timestamp timestamp, int hour, int minute, int second)

Here you can find the source of resetHourMinuteSecond(Timestamp timestamp, int hour, int minute, int second)

Description

reset Hour Minute Second

License

Open Source License

Declaration

public static Timestamp resetHourMinuteSecond(Timestamp timestamp, int hour, int minute, int second) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Timestamp;

import java.util.Calendar;

public class Main {

    public static Timestamp resetHourMinuteSecond(Timestamp timestamp, int hour, int minute, int second) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(timestamp);//from  ww  w . j  a v  a  2s. co  m
        calendar.set(Calendar.HOUR_OF_DAY, hour);
        calendar.set(Calendar.MINUTE, minute);
        calendar.set(Calendar.SECOND, second);
        return new Timestamp(calendar.getTimeInMillis());
    }
}

Related

  1. randomTimestamp()
  2. readTimestamp(ByteBuffer logBuf)
  3. readTimestamp(DataInput in)
  4. readTimestamp(ObjectInput in, long nullFlag)
  5. removeTime(Timestamp ts)
  6. roundToHour(Timestamp arg)
  7. roundToSecond(Timestamp t)
  8. safeTimestamp(Date value)
  9. setTimestamp(byte[] ba, int offset, Timestamp val)