LocalTime atDate(LocalDate date) example

Description

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  ww. j av a2  s .co  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.





















Home »
  Java Date Time »
    java.time Reference »




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