This method is useful for finding the local time in another timezone. For example, if this instant holds 12:30 in Europe/London, the result from this method with Europe/Paris would be 13:30.
The returned object will be a new instance of the same implementation type. This method changes the time zone, and does not change the millisecond instant, with the effect that the field values usually change. The returned object will be either be a new instance or this
.
@param newZone the new time zone
@return a copy of this datetime with a different time zone
@see #withZoneRetainFields
When printing, this zone will be used in preference to the zone from the datetime that would otherwise be used.
When parsing, this zone will be set on the parsed datetime.
A null zone means of no-override. If both an override chronology and an override zone are set, the override zone will take precedence over the zone in the chronology. @param zone the zone to use as an override @return the new formatter
This returns a formatter with similar state to this formatter but with the override zone set. By default, a formatter has no override zone, returning null.
If an override is added, then any instant that is formatted or parsed will be affected.
When formatting, if the temporal object contains an instant, then it will be converted to a zoned date-time using the override zone. Whether the temporal is an instant is determined by querying the {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS} field.If the input has a chronology then it will be retained unless overridden. If the input does not have a chronology, such as {@code Instant}, then the ISO chronology will be used.
If the temporal object does not contain an instant, but does contain an offset then an additional check is made. If the normalized override zone is an offset that differs from the offset of the temporal, then a {@code DateTimeException} is thrown. In all other cases, the overridezone is added to the temporal, replacing any previous zone, but without changing the date/time.
When parsing, there are two distinct cases to consider. If a zone has been parsed directly from the text, perhaps because {@link DateTimeFormatterBuilder#appendZoneId()} was used, thenthis override zone has no effect. If no zone has been parsed, then this override zone will be included in the result of the parse where it can be used to build instants and date-times.
This instance is immutable and unaffected by this method call. @param zone the new override zone, null if no override @return a formatter based on this formatter with the requested override zone, not null
This method is useful for finding the local time in another timezone. For example, if this instant holds 12:30 in Europe/London, the result from this method with Europe/Paris would be 13:30.
The returned object will be a new instance of the same implementation type. This method changes the time zone, and does not change the millisecond instant, with the effect that the field values usually change. The returned object will be either be a new instance or this
.
@param newZone the new time zone
@return a copy of this datetime with a different time zone
@see #withZoneRetainFields
When printing, this zone will be used in preference to the zone from the datetime that would otherwise be used.
When parsing, this zone will be set on the parsed datetime.
A null zone means of no-override. If both an override chronology and an override zone are set, the override zone will take precedence over the zone in the chronology. @param zone the zone to use as an override @return the new formatter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|