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 Calendar
millisToCalendar
(long epochMillis) Deprecated.private static Calendar
millisToCalendar
(long epochMillis, TimeZone timeZone) Deprecated.(package private) static Calendar
Deprecated.static Calendar
temporalToCalendar
(LocalDateTime dateTime) Deprecated.This API is ICU internal only.static Calendar
temporalToCalendar
(LocalTime time) Deprecated.This API is ICU internal only.static Calendar
temporalToCalendar
(OffsetDateTime dateTime) Deprecated.This API is ICU internal only.static Calendar
temporalToCalendar
(OffsetTime time) Deprecated.This API is ICU internal only.static Calendar
temporalToCalendar
(Temporal temp) Deprecated.This API is ICU internal only.static Calendar
temporalToCalendar
(ZonedDateTime dateTime) Deprecated.This API is ICU internal only.static TimeZone
zoneIdToTimeZone
(ZoneId zoneId) Deprecated.This API is ICU internal only.static TimeZone
zoneOffsetToTimeZone
(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 aZonedDateTime
to aCalendar
.This method creates a
Calendar
instance that represents the same date and time as the specifiedZonedDateTime
, taking into account the time zone information associated with theZonedDateTime
.- Parameters:
dateTime
- TheZonedDateTime
to convert.- Returns:
- A
Calendar
instance representing the same date and time as the specifiedZonedDateTime
, with the time zone set accordingly.
-
temporalToCalendar
Deprecated.This API is ICU internal only.Converts anOffsetTime
to aCalendar
.This method creates a
Calendar
instance that represents the same time of day as the specifiedOffsetTime
, taking into account the offset from UTC associated with theOffsetTime
. The resultingCalendar
will have its date components (year, month, day) set to the current date in the time zone represented by the offset.- Parameters:
time
- TheOffsetTime
to convert.- Returns:
- A
Calendar
instance 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 anOffsetDateTime
to aCalendar
.This method creates a
Calendar
instance that represents the same date and time as the specifiedOffsetDateTime
, taking into account the offset from UTC associated with theOffsetDateTime
.- Parameters:
dateTime
- TheOffsetDateTime
to convert.- Returns:
- A
Calendar
instance representing the same date and time as the specifiedOffsetDateTime
, with the time zone set accordingly.
-
temporalToCalendar
Deprecated.Converts aChronoLocalDate
to aCalendar
.This method creates a
Calendar
instance that represents the same date as the specifiedChronoLocalDate
. The resultingCalendar
will be in the default time zone of the JVM and will have its time components (hour, minute, second, millisecond) set to zero.- Parameters:
date
- TheChronoLocalDate
to convert.- Returns:
- A
Calendar
instance representing the same date as the specifiedChronoLocalDate
, with time components set to zero.
-
temporalToCalendar
Deprecated.This API is ICU internal only.Converts aLocalTime
to aCalendar
.This method creates a
Calendar
instance that represents the same time of day as the specifiedLocalTime
. The resultingCalendar
will 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 aChronoLocalDateTime
to aCalendar
.This method creates a
Calendar
instance that represents the same date and time as the specifiedChronoLocalDateTime
. The resultingCalendar
will be in the default time zone of the JVM.- Parameters:
dateTime
- TheChronoLocalDateTime
to convert.- Returns:
- A
Calendar
instance 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 aZoneOffset
to aTimeZone
.This method creates a
TimeZone
that has a fixed offset from UTC, represented by the givenZoneOffset
.- Parameters:
zoneOffset
- The zone offset to convert.- Returns:
- A
TimeZone
that has a fixed offset from UTC, represented by the givenZoneOffset
.
-
millisToCalendar
Deprecated. -
millisToCalendar
Deprecated.
-