Java Date Time - OffsetTime atDate(LocalDate date) example








OffsetTime atDate(LocalDate date) combines this time with a date to create an OffsetDateTime.

Syntax

atDate has the following syntax.

public OffsetDateTime atDate(LocalDate date)

Example

The following example shows how to use atDate.

import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.OffsetTime;
/*from w ww. j  a  va2s .com*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetDateTime n = m.atDate(LocalDate.now());
    System.out.println(n);

  }
}

The code above generates the following result.