OffsetDateTime of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset) example
Description
OffsetDateTime of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset)
creates
an instance of OffsetDateTime from a year, month, day, hour, minute, second, nanosecond and offset.
Syntax
of
has the following syntax.
public static OffsetDateTime of(int year,
int month,
int dayOfMonth,
int hour,
int minute,
int second,
int nanoOfSecond,
ZoneOffset offset)
Example
The following example shows how to use of
.
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
//from w w w. j a v a 2s. c om
public class Main {
public static void main(String[] args) {
OffsetDateTime o = OffsetDateTime.of(2014,1,14,12,23,23,1234,ZoneOffset.UTC);
System.out.println(o);
}
}
The code above generates the following result.