Class JavaTimeConverters
java.time
classes and the Calendar and related classes from the
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static CalendarmillisToCalendar(long epochMillis) Deprecated.private static CalendarmillisToCalendar(long epochMillis, TimeZone timeZone) Deprecated.(package private) static CalendarDeprecated.static 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.
-
Field Details
-
MILLIS_PER_DAY
private static final long MILLIS_PER_DAYDeprecated.- See Also:
-
-
Constructor Details
-
JavaTimeConverters
private JavaTimeConverters()Deprecated.
-
-
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.Converts aChronoLocalDateto aCalendar.This method creates a
Calendarinstance that represents the same date as the specifiedChronoLocalDate. The resultingCalendarwill be in the default time zone of the JVM and will have its time components (hour, minute, second, millisecond) set to zero.- Parameters:
date- TheChronoLocalDateto convert.- Returns:
- A
Calendarinstance representing the same date as the specifiedChronoLocalDate, with time components set to zero.
-
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
Deprecated.This API is ICU internal only. -
zoneIdToTimeZone
Deprecated.This API is ICU internal only. -
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.
-
millisToCalendar
Deprecated. -
millisToCalendar
Deprecated.
-