Package com.bandwidth
Class DateTimeHelper
- java.lang.Object
-
- com.bandwidth.DateTimeHelper
-
public class DateTimeHelper extends 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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LocalDateTime
fromRfc1123DateTime(String date)
Parse a datetime string in Rfc1123 format to a DateTime object.static LocalDateTime
fromRfc8601DateTime(String date)
Parse a datetime string in Rfc8601(Rfc3339) format to a DateTime object.static LocalDate
fromSimpleDate(String date)
Parse a simple date string to a LocalDate object.static LocalDateTime
fromUnixTimestamp(Long date)
Parse a Unix Timestamp to a DateTime object.static LocalDateTime
fromUnixTimestamp(String date)
Parse a Unix Timestamp string to a DateTime object.static String
toRfc1123DateTime(LocalDateTime value)
Convert a DateTime object to a Rfc1123 formatted string.static List<String>
toRfc1123DateTime(List<LocalDateTime> values)
Convert a List of DateTime objects to Rfc1123 formatted strings.static Map<String,String>
toRfc1123DateTime(Map<String,LocalDateTime> values)
Convert a Map of DateTime objects to Rfc1123 formatted strings.static String
toRfc8601DateTime(LocalDateTime value)
Convert a DateTime object to a Rfc8601(Rfc3339) formatted string.static List<String>
toRfc8601DateTime(List<LocalDateTime> values)
Convert a List of DateTime objects to Rfc8601(Rfc3339) formatted strings.static Map<String,String>
toRfc8601DateTime(Map<String,LocalDateTime> values)
Convert a Map of DateTime objects to Rfc8601(Rfc3339) formatted strings.static String
toSimpleDate(LocalDate value)
Convert a LocalDate object to a string.static List<String>
toSimpleDate(List<LocalDate> values)
Convert a List of LocalDate objects to strings.static Map<String,String>
toSimpleDate(Map<String,LocalDate> values)
Convert a Map of LocalDate objects to strings.static String
toUnixTimestamp(LocalDateTime value)
Convert a DateTime object to a Unix Timestamp string.static List<String>
toUnixTimestamp(List<LocalDateTime> values)
Convert a List of DateTime objects to Unix Timestamp strings.static Map<String,String>
toUnixTimestamp(Map<String,LocalDateTime> values)
Convert a Map of DateTime objects to Unix Timestamp strings.static Long
toUnixTimestampLong(LocalDateTime value)
Convert a DateTime object to a Unix Timestamp Long.static List<Long>
toUnixTimestampLong(List<LocalDateTime> values)
Convert a List of DateTime objects to Unix Timestamp Longs.static Map<String,Long>
toUnixTimestampLong(Map<String,LocalDateTime> values)
Convert a Map of DateTime objects to Unix Timestamp Longs.
-
-
-
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
-
-