Java Date Time - LocalTime atDate(LocalDate date) example








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

Syntax

atDate has the following syntax.

public LocalDateTime atDate(LocalDate date)

Example

The following example shows how to use atDate.

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
//from   w  w w.j  av  a2 s .c o  m
public class Main {
  public static void main(String[] args) {
    LocalTime l = LocalTime.now();
    LocalDateTime t = l.atDate(LocalDate.now());
    System.out.println(t);
  }
}

The code above generates the following result.