Source Code : Sets the time on the same day to 00:00:00.000

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Sets the time on the same day to 00:00:00.000

     
import java.util.Date;

public class Util{
  /**
   * Sets the time on the same day to 00:00:00.000
   *
   * @param date
   * @return a new date
   */
  @SuppressWarnings("deprecation")
  public static Date truncateTime(Date date) {
    Date newDate = (Date) date.clone();

    newDate.setHours(0);
    newDate.setMinutes(0);
    newDate.setSeconds(0);
    newDate.setTime(newDate.getTime() - newDate.getTime() % 1000); //Millisekunden auf 0

    return newDate;
  }
}

   
    
    
    
    
  

Thank with us