withZone method

ZonedDateTime withZone(
  1. DateTimeZone targetZone
)

Creates a new ZonedDateTime representing the same instant in time, in the same calendar but a different time zone.

  • targetZone: The target time zone to convert to.

Returns: A new value in the target time zone.

Implementation

ZonedDateTime withZone(DateTimeZone targetZone) {
  Preconditions.checkNotNull(targetZone, 'targetZone');
  return ZonedDateTime(toInstant(), targetZone, calendar);
}