Java Date Adjust getAdjustDayResetTime(Date date, int adjustAmount)

Here you can find the source of getAdjustDayResetTime(Date date, int adjustAmount)

Description

get Adjust Day Reset Time

License

Open Source License

Declaration

public static Date getAdjustDayResetTime(Date date, int adjustAmount) 

Method Source Code

//package com.java2s;
/*/*w  w  w.  j av  a  2s .co  m*/
 * CommonUtil.java 
 *
 * Copyright 2007 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

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

public class Main {

    public static Date getAdjustDayResetTime(Date date, int adjustAmount) {
        if (date == null) {
            return null;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.add(Calendar.DATE, adjustAmount);
        return cal.getTime();
    }
}

Related

  1. adjustDays(Date startingDate, int deltaDays)
  2. adjustHour(Date dt, int hour)
  3. adjustHourAndMinute(Date n)
  4. adjustTime(Date date, int hour, int minute, int second)
  5. adjustToDayStartAndEnd(Date from, Date to)
  6. getAdjustedDate(Date original, int millisecondAdjustment)
  7. getTimeWithAdjustment(Date date, boolean carryover)