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.
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)
The following example shows how to use of
.
import java.time.OffsetDateTime; import java.time.ZoneOffset; /*from ww w .ja v a 2s .c o m*/ 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.