LocalDate atTime(OffsetTime time) example

Description

LocalDate atTime(OffsetTime time) combines this date with an offset time to create an OffsetDateTime.

Syntax

atTime has the following syntax.


public OffsetDateTime atTime(OffsetTime time)

Example

The following example shows how to use atTime.


import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.OffsetTime;
// w w  w.  ja  va  2 s . c o  m
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);
    OffsetDateTime o = a.atTime(OffsetTime.now());
    
    System.out.println(o); 
  }
}

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