Language

ZonedDateTime.Of Method

Definition

Overloads

Name Description
Of(LocalDateTime, ZoneId)

Obtains an instance of ZonedDateTime from a local date-time.

Of(LocalDate, LocalTime, ZoneId)

Obtains an instance of ZonedDateTime from a local date and time.

Of(Int32, Int32, Int32, Int32, Int32, Int32, Int32, ZoneId)

Obtains an instance of ZonedDateTime from a year, month, day, hour, minute, second, nanosecond and time-zone.

Of(LocalDateTime, ZoneId)

Obtains an instance of ZonedDateTime from a local date-time.

[Android.Runtime.Register("of", "(Ljava/time/LocalDateTime;Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)]
public static Java.Time.ZonedDateTime? Of(Java.Time.LocalDateTime? localDateTime, Java.Time.ZoneId? zone);
[<Android.Runtime.Register("of", "(Ljava/time/LocalDateTime;Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)>]
static member Of : Java.Time.LocalDateTime * Java.Time.ZoneId -> Java.Time.ZonedDateTime

Parameters

localDateTime
LocalDateTime

the local date-time, not null

zone
ZoneId

the time-zone, not null

Returns

the zoned date-time, not null

Attributes

Remarks

Obtains an instance of ZonedDateTime from a local date-time. This creates a zoned date-time matching the input local date-time as closely as possible. Time-zone rules, such as daylight savings, mean that not every local date-time is valid for the specified zone, thus the local date-time may be adjusted. The local date-time is resolved to a single instant on the time-line. This is achieved by finding a valid offset from UTC/Greenwich for the local date-time as defined by the rules of the zone ID. In most cases, there is only one valid offset for a local date-time. In the case of an overlap, when clocks are set back, there are two valid offsets. This method uses the earlier offset typically corresponding to "summer". In the case of a gap, when clocks jump forward, there is no valid offset. Instead, the local date-time is adjusted to be later by the length of the gap. For a typical one hour daylight savings change, the local date-time will be moved one hour later into the offset typically corresponding to "summer".

Java reference for java.time.ZonedDateTime.of.

Applies to

Of(LocalDate, LocalTime, ZoneId)

Obtains an instance of ZonedDateTime from a local date and time.

[Android.Runtime.Register("of", "(Ljava/time/LocalDate;Ljava/time/LocalTime;Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)]
public static Java.Time.ZonedDateTime? Of(Java.Time.LocalDate? date, Java.Time.LocalTime? time, Java.Time.ZoneId? zone);
[<Android.Runtime.Register("of", "(Ljava/time/LocalDate;Ljava/time/LocalTime;Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)>]
static member Of : Java.Time.LocalDate * Java.Time.LocalTime * Java.Time.ZoneId -> Java.Time.ZonedDateTime

Parameters

date
LocalDate

the local date, not null

time
LocalTime

the local time, not null

zone
ZoneId

the time-zone, not null

Returns

the offset date-time, not null

Attributes

Remarks

Obtains an instance of ZonedDateTime from a local date and time. This creates a zoned date-time matching the input local date and time as closely as possible. Time-zone rules, such as daylight savings, mean that not every local date-time is valid for the specified zone, thus the local date-time may be adjusted. The local date time and first combined to form a local date-time. The local date-time is then resolved to a single instant on the time-line. This is achieved by finding a valid offset from UTC/Greenwich for the local date-time as defined by the rules of the zone ID. In most cases, there is only one valid offset for a local date-time. In the case of an overlap, when clocks are set back, there are two valid offsets. This method uses the earlier offset typically corresponding to "summer". In the case of a gap, when clocks jump forward, there is no valid offset. Instead, the local date-time is adjusted to be later by the length of the gap. For a typical one hour daylight savings change, the local date-time will be moved one hour later into the offset typically corresponding to "summer".

Java reference for java.time.ZonedDateTime.of.

Applies to

Of(Int32, Int32, Int32, Int32, Int32, Int32, Int32, ZoneId)

Obtains an instance of ZonedDateTime from a year, month, day, hour, minute, second, nanosecond and time-zone.

[Android.Runtime.Register("of", "(IIIIIIILjava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)]
public static Java.Time.ZonedDateTime? Of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, Java.Time.ZoneId? zone);
[<Android.Runtime.Register("of", "(IIIIIIILjava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)>]
static member Of : int * int * int * int * int * int * int * Java.Time.ZoneId -> Java.Time.ZonedDateTime

Parameters

year
Int32

the year to represent, from MIN_YEAR to MAX_YEAR

month
Int32

the month-of-year to represent, from 1 (January) to 12 (December)

dayOfMonth
Int32

the day-of-month to represent, from 1 to 31

hour
Int32

the hour-of-day to represent, from 0 to 23

minute
Int32

the minute-of-hour to represent, from 0 to 59

second
Int32

the second-of-minute to represent, from 0 to 59

nanoOfSecond
Int32

the nano-of-second to represent, from 0 to 999,999,999

zone
ZoneId

the time-zone, not null

Returns

the offset date-time, not null

Attributes

Remarks

Obtains an instance of ZonedDateTime from a year, month, day, hour, minute, second, nanosecond and time-zone. This creates a zoned date-time matching the local date-time of the seven specified fields as closely as possible. Time-zone rules, such as daylight savings, mean that not every local date-time is valid for the specified zone, thus the local date-time may be adjusted. The local date-time is resolved to a single instant on the time-line. This is achieved by finding a valid offset from UTC/Greenwich for the local date-time as defined by the rules of the zone ID. In most cases, there is only one valid offset for a local date-time. In the case of an overlap, when clocks are set back, there are two valid offsets. This method uses the earlier offset typically corresponding to "summer". In the case of a gap, when clocks jump forward, there is no valid offset. Instead, the local date-time is adjusted to be later by the length of the gap. For a typical one hour daylight savings change, the local date-time will be moved one hour later into the offset typically corresponding to "summer". This method exists primarily for writing test cases. Non test-code will typically use other methods to create an offset time. LocalDateTime has five additional convenience variants of the equivalent factory method taking fewer arguments. They are not provided here to reduce the footprint of the API.

Java reference for java.time.ZonedDateTime.of.

Applies to