Package com.bandwidth

Class DateTimeHelper

java.lang.Object
com.bandwidth.DateTimeHelper

public class DateTimeHelper
extends java.lang.Object
This is a utility class for DateTime operations.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  DateTimeHelper.Rfc1123DateTimeDeserializer
    A class to handle deserialization of DateTime objects to Rfc1123 format strings.
    static class  DateTimeHelper.Rfc1123DateTimeSerializer
    A class to handle serialization of Rfc1123 format strings to DateTime objects.
    static class  DateTimeHelper.Rfc8601DateTimeDeserializer
    A class to handle deserialization of DateTime objects to Rfc8601(Rfc3339) format strings.
    static class  DateTimeHelper.Rfc8601DateTimeSerializer
    A class to handle serialization of Rfc8601(Rfc3339) format strings to DateTime objects.
    static class  DateTimeHelper.SimpleDateDeserializer
    A class to handle deserialization of date strings to LocalDate objects.
    static class  DateTimeHelper.SimpleDateSerializer
    A class to handle serialization of LocalDate objects to date strings.
    static class  DateTimeHelper.UnixTimestampDeserializer
    A class to handle deserialization of DateTime objects to Unix Timestamps.
    static class  DateTimeHelper.UnixTimestampSerializer
    A class to handle serialization of Unix Timestamps to DateTime objects.
  • Constructor Summary

    Constructors 
    Constructor Description
    DateTimeHelper()  
  • Method Summary

    Modifier and Type Method Description
    static java.time.LocalDateTime fromRfc1123DateTime​(java.lang.String date)
    Parse a datetime string in Rfc1123 format to a DateTime object.
    static java.time.LocalDateTime fromRfc8601DateTime​(java.lang.String date)
    Parse a datetime string in Rfc8601(Rfc3339) format to a DateTime object.
    static java.time.LocalDate fromSimpleDate​(java.lang.String date)
    Parse a simple date string to a LocalDate object.
    static java.time.LocalDateTime fromUnixTimestamp​(java.lang.Long date)
    Parse a Unix Timestamp to a DateTime object.
    static java.time.LocalDateTime fromUnixTimestamp​(java.lang.String date)
    Parse a Unix Timestamp string to a DateTime object.
    static java.lang.String toRfc1123DateTime​(java.time.LocalDateTime value)
    Convert a DateTime object to a Rfc1123 formatted string.
    static java.util.List<java.lang.String> toRfc1123DateTime​(java.util.List<java.time.LocalDateTime> values)
    Convert a List of DateTime objects to Rfc1123 formatted strings.
    static java.lang.String toRfc8601DateTime​(java.time.LocalDateTime value)
    Convert a DateTime object to a Rfc8601(Rfc3339) formatted string.
    static java.util.List<java.lang.String> toRfc8601DateTime​(java.util.List<java.time.LocalDateTime> values)
    Convert a List of DateTime objects to Rfc8601(Rfc3339) formatted strings.
    static java.lang.String toSimpleDate​(java.time.LocalDate value)
    Convert a LocalDate object to a string.
    static java.util.List<java.lang.String> toSimpleDate​(java.util.List<java.time.LocalDate> values)
    Convert a List of LocalDate objects to strings.
    static java.lang.String toUnixTimestamp​(java.time.LocalDateTime value)
    Convert a DateTime object to a Unix Timestamp string.
    static java.util.List<java.lang.String> toUnixTimestamp​(java.util.List<java.time.LocalDateTime> values)
    Convert a List of DateTime objects to Unix Timestamp strings.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • fromUnixTimestamp

      public static java.time.LocalDateTime fromUnixTimestamp​(java.lang.Long date)
      Parse a Unix Timestamp to a DateTime object.
      Parameters:
      date - The Unix Timestamp
      Returns:
      The DateTime object
    • fromUnixTimestamp

      public static java.time.LocalDateTime fromUnixTimestamp​(java.lang.String date)
      Parse a Unix Timestamp string to a DateTime object.
      Parameters:
      date - The Unix Timestamp as a String
      Returns:
      The parsed DateTime object
    • toUnixTimestamp

      public static java.lang.String toUnixTimestamp​(java.time.LocalDateTime value)
      Convert a DateTime object to a Unix Timestamp string.
      Parameters:
      value - The DateTime object to convert
      Returns:
      The converted String
    • toUnixTimestamp

      public static java.util.List<java.lang.String> toUnixTimestamp​(java.util.List<java.time.LocalDateTime> values)
      Convert a List of DateTime objects to Unix Timestamp strings.
      Parameters:
      values - The List of DateTime objects to convert
      Returns:
      The list of converted Strings
    • fromRfc1123DateTime

      public static java.time.LocalDateTime fromRfc1123DateTime​(java.lang.String date)
      Parse a datetime string in Rfc1123 format to a DateTime object.
      Parameters:
      date - The datetime string in Rfc1123 format
      Returns:
      The parsed DateTime object
    • toRfc1123DateTime

      public static java.lang.String toRfc1123DateTime​(java.time.LocalDateTime value)
      Convert a DateTime object to a Rfc1123 formatted string.
      Parameters:
      value - The DateTime object to convert
      Returns:
      The converted String
    • toRfc1123DateTime

      public static java.util.List<java.lang.String> toRfc1123DateTime​(java.util.List<java.time.LocalDateTime> values)
      Convert a List of DateTime objects to Rfc1123 formatted strings.
      Parameters:
      values - The List of DateTime objects to convert
      Returns:
      The List of converted Strings
    • fromRfc8601DateTime

      public static java.time.LocalDateTime fromRfc8601DateTime​(java.lang.String date)
      Parse a datetime string in Rfc8601(Rfc3339) format to a DateTime object.
      Parameters:
      date - The datetime string in Rfc8601(Rfc3339) format
      Returns:
      The parsed DateTime object
    • toRfc8601DateTime

      public static java.lang.String toRfc8601DateTime​(java.time.LocalDateTime value)
      Convert a DateTime object to a Rfc8601(Rfc3339) formatted string.
      Parameters:
      value - The DateTime object to convert
      Returns:
      The converted String
    • toRfc8601DateTime

      public static java.util.List<java.lang.String> toRfc8601DateTime​(java.util.List<java.time.LocalDateTime> values)
      Convert a List of DateTime objects to Rfc8601(Rfc3339) formatted strings.
      Parameters:
      values - The List of DateTime objects to convert
      Returns:
      The List of converted Strings
    • fromSimpleDate

      public static java.time.LocalDate fromSimpleDate​(java.lang.String date)
      Parse a simple date string to a LocalDate object.
      Parameters:
      date - The date string
      Returns:
      The parsed LocalDate object
    • toSimpleDate

      public static java.lang.String toSimpleDate​(java.time.LocalDate value)
      Convert a LocalDate object to a string.
      Parameters:
      value - The LocalDate object to convert
      Returns:
      The converted Strings
    • toSimpleDate

      public static java.util.List<java.lang.String> toSimpleDate​(java.util.List<java.time.LocalDate> values)
      Convert a List of LocalDate objects to strings.
      Parameters:
      values - The List of LocalDate objects to convert
      Returns:
      The List of converted Strings