ZonedDateTime of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneId zone) example

Description

ZonedDateTime of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneId zone) creates an instance of ZonedDateTime from a year, month, day, hour, minute, second, nanosecond and time-zone.

Syntax

of has the following syntax.


public static ZonedDateTime of(int year,   
                               int month,   
                               int dayOfMonth,   
                               int hour,   
                               int minute,   
                               int second,   
                               int nanoOfSecond,   
                               ZoneId zone)

Example

The following example shows how to use of.


import java.time.ZoneId;
import java.time.ZonedDateTime;
//  w w  w .ja  va 2s.  c o m
public class Main {
  public static void main(String[] args) {
    ZonedDateTime z = ZonedDateTime.of(2014,9,3,12,12,123,1234,ZoneId.systemDefault());
    
    System.out.println(z);

  }
}




















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset