I have a problem resetting hours in Java. For a given date I want to set the hours to 00:00:00.
This is my code :
/**
* Resets milliseconds, se
Using the java.time framework built into Java 8 and later. See Tutorial.
import java.time.LocalTime;
import java.time.LocalDateTime;
LocalDateTime now = LocalDateTime.now(); # 2015-11-19T19:42:19.224
# start of a day
now.with(LocalTime.MIN); # 2015-11-19T00:00
now.with(LocalTime.MIDNIGHT); # 2015-11-19T00:00
If you do not need time-of-day (hour, minute, second etc. parts) consider using LocalDate class.
LocalDate.now(); # 2015-11-19