Package com.bandwidth

Class DateTimeHelper


  • public class DateTimeHelper
    extends Object
    This is a utility class for DateTime operations.
    • Constructor Detail

      • DateTimeHelper

        public DateTimeHelper()
    • Method Detail

      • fromUnixTimestamp

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

        public static LocalDateTime fromUnixTimestamp​(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 String toUnixTimestamp​(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 List<String> toUnixTimestamp​(List<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
      • toUnixTimestamp

        public static Map<String,​String> toUnixTimestamp​(Map<String,​LocalDateTime> values)
        Convert a Map of DateTime objects to Unix Timestamp strings.
        Parameters:
        values - The Map of DateTime objects to convert
        Returns:
        The Map of converted Strings
      • toUnixTimestampLong

        public static Long toUnixTimestampLong​(LocalDateTime value)
        Convert a DateTime object to a Unix Timestamp Long.
        Parameters:
        value - The DateTime object to convert
        Returns:
        The converted Long
      • toUnixTimestampLong

        public static List<Long> toUnixTimestampLong​(List<LocalDateTime> values)
        Convert a List of DateTime objects to Unix Timestamp Longs.
        Parameters:
        values - The List of DateTime objects to convert
        Returns:
        The list of converted Longs.
      • toUnixTimestampLong

        public static Map<String,​Long> toUnixTimestampLong​(Map<String,​LocalDateTime> values)
        Convert a Map of DateTime objects to Unix Timestamp Longs.
        Parameters:
        values - The Map of DateTime objects to convert
        Returns:
        The Map of converted Longs.
      • fromRfc1123DateTime

        public static LocalDateTime fromRfc1123DateTime​(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 String toRfc1123DateTime​(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 List<String> toRfc1123DateTime​(List<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
      • toRfc1123DateTime

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

        public static LocalDateTime fromRfc8601DateTime​(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 String toRfc8601DateTime​(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 List<String> toRfc8601DateTime​(List<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
      • toRfc8601DateTime

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

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

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

        public static List<String> toSimpleDate​(List<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
      • toSimpleDate

        public static Map<String,​String> toSimpleDate​(Map<String,​LocalDate> values)
        Convert a Map of LocalDate objects to strings.
        Parameters:
        values - The Map of LocalDate objects to convert
        Returns:
        The Map of converted Strings