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