withCalendar method

OffsetDateTime withCalendar(
  1. CalendarSystem calendar
)

Creates a new OffsetDateTime representing the same physical date, time and offset, but in a different calendar. The returned OffsetDateTime is likely to have different date field values to this one. For example, January 1st 1970 in the Gregorian calendar was December 19th 1969 in the Julian calendar.

  • calendar: The calendar system to convert this offset date and time to.

Returns: The converted OffsetDateTime.

Implementation

OffsetDateTime withCalendar(CalendarSystem calendar) {
  // todo: equivalent?
  // LocalDate newDate = calendarDate.withCalendar(calendar);
  return OffsetDateTime(localDateTime.withCalendar(calendar), offset);
}