Java Date Time - LocalDate atStartOfDay() example








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;
// w  w w. j a v a2  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.