Java examples for java.time:Instant
get Start Of Day from java.util.Date via Instant
//package com.java2s; import java.time.ZoneId; import java.time.temporal.ChronoUnit; import java.util.Date; public class Main { public static Date getStartOfDay(Date date) { if (date == null) { return null; }/*from w w w . ja v a 2s. c o m*/ return Date.from(date.toInstant().atZone(ZoneId.systemDefault()) .truncatedTo(ChronoUnit.DAYS).toInstant()); } }