LocalDate atStartOfDay() example

Description

LocalDate atStartOfDay() combines this date with the time of midnight to create a LocalDateTime at the start of this date.

Syntax

atStartOfDay has the following syntax.


public LocalDateTime atStartOfDay()

Example

The following example shows how to use atStartOfDay.


import java.time.LocalDate;
import java.time.LocalDateTime;
//from w w  w.  ja v  a 2  s . c  o  m
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);
    
    LocalDateTime l = a.atStartOfDay();
    System.out.println(l); 
  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset