Class DateUtil

java.lang.Object
com.sinch.sdk.core.utils.DateUtil

public class DateUtil extends Object
Utility class for Date
  • Method Details

    • toInstant

      public static Instant toInstant(OffsetDateTime value)
      Convert an OffsetDateTime to Instant with null value protection
      Parameters:
      value - Value to be converted
      Returns:
      Converted value to Instant or null if source value was null
      Since:
      1.0
    • failSafeTimeStampToInstant

      public static Instant failSafeTimeStampToInstant(String value)
      Convert String to Instant

      Consume a date time in form of

      • ISO8601 with TZ
      • YYYY-MM-DDThh:mm:ss.SSS without timezone
      • YYYY-MM-DDThh:mm:ss.SSSZ with timezone
      When timezone is not known, UTC is assumed
      Parameters:
      value - A nearly IS08601 compliant string
      Returns:
      Extracted Instant value
      Since:
      1.1