Java Date Time - LocalDate atTime(OffsetTime time) example








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;
/* ww  w .  j  a  v  a 2s . co 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.