Java TimeUnit Usage roundTimestampToNexDay(long timestamp)

Here you can find the source of roundTimestampToNexDay(long timestamp)

Description

round Timestamp To Nex Day

License

Open Source License

Declaration

public static final long roundTimestampToNexDay(long timestamp) 

Method Source Code


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

import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;

public class Main {
    public static final long roundTimestampToNexDay(long timestamp) {
        return roundTimestampToDay(timestamp) + TimeUnit.DAYS.toMillis(1);
    }/*from   www.  j  a v  a2  s .c  om*/

    public static final long roundTimestampToDay(long timestamp) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date(timestamp));
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTimeInMillis();
    }
}

Related

  1. printTimeMap(Map timeMap)
  2. printTimeString(long time)
  3. printTiming(long start, long end)
  4. randomNanos(Random rand, int decimalDigits)
  5. rangeOf(final Date date, final int beforeDates, final int afterDates)
  6. run(Callable task, long timeout)
  7. second(long second)
  8. seconds(long timeInMillis)
  9. secondsFromNow(long seconds)