Class JavaTimeConverters
java.time
classes and the Calendar and related classes from the
org.graalvm.shadowed.com.ibm.icu.util package.
The class includes methods for converting various temporal types, such as
ZonedDateTime, OffsetTime, OffsetDateTime, LocalTime,
ChronoLocalDate, and ChronoLocalDateTime, to Calendar instances.
Additionally, it provides methods to convert between ZoneId and TimeZone, and
ZoneOffset and TimeZone.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CalendartemporalToCalendar(LocalDateTime dateTime) Deprecated.This API is ICU internal only.static CalendartemporalToCalendar(LocalTime time) Deprecated.This API is ICU internal only.static CalendartemporalToCalendar(OffsetDateTime dateTime) Deprecated.This API is ICU internal only.static CalendartemporalToCalendar(OffsetTime time) Deprecated.This API is ICU internal only.static CalendartemporalToCalendar(Temporal temp) Deprecated.This API is ICU internal only.static CalendartemporalToCalendar(ZonedDateTime dateTime) Deprecated.This API is ICU internal only.static TimeZonezoneIdToTimeZone(ZoneId zoneId) Deprecated.This API is ICU internal only.static TimeZonezoneOffsetToTimeZone(ZoneOffset zoneOffset) Deprecated.This API is ICU internal only.
-
Method Details
-
temporalToCalendar
Deprecated.This API is ICU internal only.Converts aZonedDateTimeto aCalendar.This method creates a
Calendarinstance that represents the same date and time as the specifiedZonedDateTime, taking into account the time zone information associated with theZonedDateTime.- Parameters:
dateTime- TheZonedDateTimeto convert.- Returns:
- A
Calendarinstance representing the same date and time as the specifiedZonedDateTime, with the time zone set accordingly.
-
temporalToCalendar
Deprecated.This API is ICU internal only.Converts anOffsetTimeto aCalendar.This method creates a
Calendarinstance that represents the same time of day as the specifiedOffsetTime, taking into account the offset from UTC associated with theOffsetTime. The resultingCalendarwill have its date components (year, month, day) set to the current date in the time zone represented by the offset.- Parameters:
time- TheOffsetTimeto convert.- Returns:
- A
Calendarinstance representing the same time of day as the specifiedOffsetTime, with the time zone set accordingly and date components set to the current date in that time zone.
-
temporalToCalendar
Deprecated.This API is ICU internal only.Converts anOffsetDateTimeto aCalendar.This method creates a
Calendarinstance that represents the same date and time as the specifiedOffsetDateTime, taking into account the offset from UTC associated with theOffsetDateTime.- Parameters:
dateTime- TheOffsetDateTimeto convert.- Returns:
- A
Calendarinstance representing the same date and time as the specifiedOffsetDateTime, with the time zone set accordingly.
-
temporalToCalendar
Deprecated.This API is ICU internal only.Converts aLocalTimeto aCalendar.This method creates a
Calendarinstance that represents the same time of day as the specifiedLocalTime. The resultingCalendarwill be in the default time zone of the JVM and will have its date components (year, month, day) set to the current date in the default time zone. -
temporalToCalendar
Deprecated.This API is ICU internal only.Converts aChronoLocalDateTimeto aCalendar.This method creates a
Calendarinstance that represents the same date and time as the specifiedChronoLocalDateTime. The resultingCalendarwill be in the default time zone of the JVM.- Parameters:
dateTime- TheChronoLocalDateTimeto convert.- Returns:
- A
Calendarinstance representing the same date and time as the specifiedChronoLocalDateTime.
-
temporalToCalendar
-
zoneIdToTimeZone
-
zoneOffsetToTimeZone
Deprecated.This API is ICU internal only.Converts aZoneOffsetto aTimeZone.This method creates a
TimeZonethat has a fixed offset from UTC, represented by the givenZoneOffset.- Parameters:
zoneOffset- The zone offset to convert.- Returns:
- A
TimeZonethat has a fixed offset from UTC, represented by the givenZoneOffset.
-