Class JavaTimeConverters

java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.JavaTimeConverters

@Deprecated public class JavaTimeConverters extends Object
Deprecated.
This API is ICU internal only.
This class provides utility methods for converting between Java 8's 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 Details

    • temporalToCalendar

      @Deprecated public static Calendar temporalToCalendar(ZonedDateTime dateTime)
      Deprecated.
      This API is ICU internal only.
      Converts a ZonedDateTime to a Calendar.

      This method creates a Calendar instance that represents the same date and time as the specified ZonedDateTime, taking into account the time zone information associated with the ZonedDateTime.

      Parameters:
      dateTime - The ZonedDateTime to convert.
      Returns:
      A Calendar instance representing the same date and time as the specified ZonedDateTime, with the time zone set accordingly.
    • temporalToCalendar

      @Deprecated public static Calendar temporalToCalendar(OffsetTime time)
      Deprecated.
      This API is ICU internal only.
      Converts an OffsetTime to a Calendar.

      This method creates a Calendar instance that represents the same time of day as the specified OffsetTime, taking into account the offset from UTC associated with the OffsetTime. The resulting Calendar will have its date components (year, month, day) set to the current date in the time zone represented by the offset.

      Parameters:
      time - The OffsetTime to convert.
      Returns:
      A Calendar instance representing the same time of day as the specified OffsetTime, with the time zone set accordingly and date components set to the current date in that time zone.
    • temporalToCalendar

      @Deprecated public static Calendar temporalToCalendar(OffsetDateTime dateTime)
      Deprecated.
      This API is ICU internal only.
      Converts an OffsetDateTime to a Calendar.

      This method creates a Calendar instance that represents the same date and time as the specified OffsetDateTime, taking into account the offset from UTC associated with the OffsetDateTime.

      Parameters:
      dateTime - The OffsetDateTime to convert.
      Returns:
      A Calendar instance representing the same date and time as the specified OffsetDateTime, with the time zone set accordingly.
    • temporalToCalendar

      @Deprecated public static Calendar temporalToCalendar(LocalTime time)
      Deprecated.
      This API is ICU internal only.
      Converts a LocalTime to a Calendar.

      This method creates a Calendar instance that represents the same time of day as the specified LocalTime. The resulting Calendar 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.

      Parameters:
      time - The LocalTime to convert.
      Returns:
      A Calendar instance representing the same time of day as the specified LocalTime, with date components set to the current date in the default time zone.
    • temporalToCalendar

      @Deprecated public static Calendar temporalToCalendar(LocalDateTime dateTime)
      Deprecated.
      This API is ICU internal only.
      Converts a ChronoLocalDateTime to a Calendar.

      This method creates a Calendar instance that represents the same date and time as the specified ChronoLocalDateTime. The resulting Calendar will be in the default time zone of the JVM.

      Parameters:
      dateTime - The ChronoLocalDateTime to convert.
      Returns:
      A Calendar instance representing the same date and time as the specified ChronoLocalDateTime.
    • temporalToCalendar

      @Deprecated public static Calendar temporalToCalendar(Temporal temp)
      Deprecated.
      This API is ICU internal only.
      Converts a Temporal to a Calendar.
      Parameters:
      temp - The Temporal to convert.
      Returns:
      A Calendar instance representing the same date and time as the specified Temporal.
    • zoneIdToTimeZone

      @Deprecated public static TimeZone zoneIdToTimeZone(ZoneId zoneId)
      Deprecated.
      This API is ICU internal only.
      Converts a ZoneId to a TimeZone.

      This method creates a TimeZone from the specified ZoneId. The resulting TimeZone will represent the time zone rules associated with the given ZoneId.

      Parameters:
      zoneId - The zone ID to convert.
      Returns:
      A TimeZone representing the time zone rules associated with the given ZoneId.
    • zoneOffsetToTimeZone

      @Deprecated public static TimeZone zoneOffsetToTimeZone(ZoneOffset zoneOffset)
      Deprecated.
      This API is ICU internal only.
      Converts a ZoneOffset to a TimeZone.

      This method creates a TimeZone that has a fixed offset from UTC, represented by the given ZoneOffset.

      Parameters:
      zoneOffset - The zone offset to convert.
      Returns:
      A TimeZone that has a fixed offset from UTC, represented by the given ZoneOffset.