OffsetDateTime of(LocalDate date, LocalTime time, ZoneOffset offset) example
Description
OffsetDateTime of(LocalDate date, LocalTime time, ZoneOffset offset)
Obtains an instance of OffsetDateTime from a date, time and offset.
Syntax
of
has the following syntax.
public static OffsetDateTime of(LocalDate date, LocalTime time, ZoneOffset offset)
Example
The following example shows how to use of
.
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
//www .java 2s . c o m
public class Main {
public static void main(String[] args) {
OffsetDateTime o = OffsetDateTime.of(LocalDate.now(),LocalTime.NOON, ZoneOffset.UTC);
System.out.println(o);
}
}
The code above generates the following result.