Java TimeUnit Usage getDateWithoutTime(final Calendar calendar)

Here you can find the source of getDateWithoutTime(final Calendar calendar)

Description

get Date Without Time

License

Apache License

Declaration

public static Date getDateWithoutTime(final Calendar calendar) 

Method Source Code

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

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

import java.util.concurrent.TimeUnit;

public class Main {
    public static final long SECOND = TimeUnit.SECONDS.toMillis(1);
    public static final long MINUTE = TimeUnit.MINUTES.toMillis(1);

    public static Date getDateWithoutTime(final Calendar calendar) {
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }/*from  ww  w . ja v  a2  s .  c  om*/
}

Related

  1. getCurrentTimeMillis()
  2. getCurrentTimestamp()
  3. getCurrentTimestampInSeconds()
  4. getDate(final int oceanTime)
  5. getDateBefore(final Date day)
  6. getDayFromTimestamp(final long unixTimestamp)
  7. getDays(final long ms)
  8. getDays(long endTs, Long lookback)
  9. getDeltaBetweenTimestamps(final long start, final long end)