withCalendar method

LocalDateTime withCalendar(
  1. CalendarSystem calendar
)

Creates a new LocalDateTime representing the same physical date and time, but in a different calendar. The returned LocalDateTime 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 local date to.

Returns: The converted LocalDateTime.

Implementation

LocalDateTime withCalendar(CalendarSystem calendar) {
  Preconditions.checkNotNull(calendar, 'calendar');
  return LocalDateTime.localDateAtTime(calendarDate.withCalendar(calendar), clockTime);
}