TL; DR
If you meant midnight in UTC in the old legacy java.util.Date object ...
java.util.Date.from( OffsetDateTime.of( LocalDate.of( 2017 , Month.JANUARY , 23 ) , LocalTime.MIN , ZoneOffset.UTC ).toInstant() )
If possible, drop the previous part of Date above and just use modern java.time.OffsetDateTime or java.time.Instant object ...
OffsetDateTime.of( LocalDate.of( 2017 , Month.JANUARY , 23 ) , LocalTime.MIN , ZoneOffset.UTC ).toInstant()
If you meant midnight at a specific time zone , not UTC ...
LocalDate.now() .atStartOfDay()
It is better to specify the desired / expected time zone than to implicitly refer to the current default.
LocalDate.now( ZoneId.of( "Pacific/Auckland" ) ) .atStartOfDay( ZoneId.of( "Pacific/Auckland" ) )
More details
Attention Not every day in every time zone is 00:00:00. Daylight saving time can go to 1 a.m., excluding midnight.
java.time
Using java.time classes that supersede the nasty old obsolete time classes such as java.util.Date and .Calendar .
ZoneId z = ZoneId.of( "America/Montreal" ); LocalDate localDate = LocalDate.now( z ); ZonedDateTime zdt = localDate.atStartOfDay( z );
Converting to / from obsolete classes
You should stick to modern java.time classes whenever possible. But if you have instances of old heritage classes, you can convert to / from java.time. Look at the new methods added to the old classes .
Calendar myLegacyCal = GregorianCalendar.from( zdt ) ; Date myLegacyDate = Date.from( zdt.toInstant() ) ;
If you want java.util.Date , which is always in the UTC time zone, to have the time of day 00:00:00, use OffsetDateTime with the constant ZoneOffset.UTC .
OffsetDateTime odt = OffsetDateTime.of( localDate , LocalTime.MIN , ZoneOffset.UTC ) ; Date myLegacyDate = Date.from( odt.toInstant() ) ;
About java.time
The java.time framework is built into Java 8 and later. These classes supersede the nasty old legacy datetime classes such as java.util.Date , Calendar and SimpleDateFormat .
The Joda-Time project, now in maintenance mode , we recommend switching to the java.time classes.
To learn more, see the Oracle Tutorial . And search for qaru for many examples and explanations. JSR 310 specification .
Where to get java.time classes?
The ThreeTen-Extra project extends java.time with additional classes. This project is proof of possible future additions to java.time. Here you can find useful classes such as Interval , YearWeek , YearQuarter and more .
Joda time
UPDATE: The Joda-Time project is now in maintenance mode. The team advises switching to the java.time classes. This section has remained untouched as a story.
Use Joda-Time 2.3, using a method for this purpose: withTimeAtStartOfDay () .
At startup ...
now: 2013-12-05T23:00:23.785-08:00 firstMomentOfToday: 2013-12-05T00:00:00.000-08:00