Java Date Time - LocalDate atTime(LocalTime time) example








LocalDate atTime(LocalTime time) combines this date with a time to create a LocalDateTime.

Syntax

atTime has the following syntax.

public LocalDateTime atTime(LocalTime time)

Example

The following example shows how to use atTime.

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
//ww  w .j av  a  2s.  com
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);

    LocalDateTime l = a.atTime(LocalTime.NOON);    
    System.out.println(l); 
  }
}

The code above generates the following result.