Class DateTimeConverter
- java.lang.Object
-
- org.apache.qpid.server.query.engine.parsing.converter.DateTimeConverter
-
public final class DateTimeConverter extends Object
Utility class for datetime conversions
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DateTimeFormattergetFormatter()Returns DateTimeFormatter usedstatic <R> booleanisDateTime(R value)Checks whether value provided belongs to datetime types or notstatic InstanttoInstant(LocalDate localDate)Converts local date to instantstatic InstanttoInstant(LocalDateTime localDateTime)Converts local datetime to instantstatic InstanttoInstant(Date date)Converts date to instantstatic <T> Function<T,Instant>toInstantMapper()Returns function mapping datetime to instantstatic <R> LongtoLong(R date)Converts datetime value to long (milliseconds)static StringtoString(Instant instant)Converts instant to stringstatic StringtoString(LocalDate localDate)Converts local date to stringstatic StringtoString(LocalDateTime dateTime)Converts local datetime to stringstatic StringtoString(Date date)Converts date to stringstatic <T> Function<T,String>toStringMapper()Returns function mapping datetime to string
-
-
-
Method Detail
-
toString
public static String toString(Date date)
Converts date to string- Parameters:
date- Date instance- Returns:
- String representation of date
-
toString
public static String toString(Instant instant)
Converts instant to string- Parameters:
instant- Instant instance- Returns:
- String representation of instant
-
toString
public static String toString(LocalDate localDate)
Converts local date to string- Parameters:
localDate- LocalDate instance- Returns:
- String representation of localDate
-
toString
public static String toString(LocalDateTime dateTime)
Converts local datetime to string- Parameters:
dateTime- LocalDateTime instance- Returns:
- String representation of local dateTime
-
toInstant
public static Instant toInstant(Date date)
Converts date to instant- Parameters:
date- Date instance- Returns:
- Instant instance
-
toInstant
public static Instant toInstant(LocalDate localDate)
Converts local date to instant- Parameters:
localDate- LocalDate instance- Returns:
- Instant instance
-
toInstant
public static Instant toInstant(LocalDateTime localDateTime)
Converts local datetime to instant- Parameters:
localDateTime- LocalDateTime instance- Returns:
- Instant instance
-
isDateTime
public static <R> boolean isDateTime(R value)
Checks whether value provided belongs to datetime types or not- Type Parameters:
R- Return parameter type- Parameters:
value- Value to check- Returns:
- True or false
-
toStringMapper
public static <T> Function<T,String> toStringMapper()
Returns function mapping datetime to string- Type Parameters:
T- Input parameter type- Returns:
- Mapping function
-
toInstantMapper
public static <T> Function<T,Instant> toInstantMapper()
Returns function mapping datetime to instant- Type Parameters:
T- Input parameter type- Returns:
- Mapping function
-
toLong
public static <R> Long toLong(R date)
Converts datetime value to long (milliseconds)- Type Parameters:
R- Return parameter type- Parameters:
date- Datetime value to be converted- Returns:
- Long
-
getFormatter
public static DateTimeFormatter getFormatter()
Returns DateTimeFormatter used- Returns:
- DateTimeFormatter instance
-
-