Class UtilitiesDateFormatter
-
- All Implemented Interfaces:
public class UtilitiesDateFormatter
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringDATE_FORMAT_WITH_SECONDS
-
Constructor Summary
Constructors Constructor Description UtilitiesDateFormatter()
-
Method Summary
Modifier and Type Method Description static StringconvertDateToReadableDate(Date date)static StringconvertTimestampToReadableDate(long timestamp)static StringconvertTimestampToReadableDate(long timestamp, int dateFormat, int timeFormat)convert timestamp to a readable date, with desired format for date and time, values accepted: DateFormat.FULL/LONG/.../SHORT. static StringconvertTimestampToReadableDate(long timestamp, int dateFormat)convert timestamp to a readable date, with desired format for date, values accepted: DateFormat.FULL/LONG/.../SHORT. static StringconvertTimestampToKaijuDate(long timestamp)Convert timestamps in millis to date format yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z" according to the timezone. static StringconvertTimestampToKaijuDateUTC(long timestampMs)Convert a timestamp to readable without any timezone shifting. static longconvertKaijuDateToTimestamp(String formattedDate)Convert date returned by Kaiju to timestamp in milliseconds. static Map.Entry<Integer, Integer>convertKaijuDateToMonthNYear(@Nullable() String formattedDate)static longgetTimestamMs(@IntRange(from = 1, to = 12) int month, int year)-
-
Method Detail
-
convertDateToReadableDate
static String convertDateToReadableDate(Date date)
-
convertTimestampToReadableDate
static String convertTimestampToReadableDate(long timestamp)
-
convertTimestampToReadableDate
static String convertTimestampToReadableDate(long timestamp, int dateFormat, int timeFormat)
convert timestamp to a readable date, with desired format for date and time, values accepted: DateFormat.FULL/LONG/.../SHORT.
- Parameters:
dateFormat- value must be provided by DateFormattimeFormat- value must be provided by DateFormat
-
convertTimestampToReadableDate
static String convertTimestampToReadableDate(long timestamp, int dateFormat)
convert timestamp to a readable date, with desired format for date, values accepted: DateFormat.FULL/LONG/.../SHORT.
- Parameters:
dateFormat- value must be provided by DateFormat
-
convertTimestampToKaijuDate
static String convertTimestampToKaijuDate(long timestamp)
Convert timestamps in millis to date format yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z" according to the timezone.
-
convertTimestampToKaijuDateUTC
static String convertTimestampToKaijuDateUTC(long timestampMs)
Convert a timestamp to readable without any timezone shifting.
-
convertKaijuDateToTimestamp
@NonNull() static long convertKaijuDateToTimestamp(String formattedDate)
Convert date returned by Kaiju to timestamp in milliseconds. Date format of Kaiju is: 2022-02-11T11:51:08.291901Z
- Parameters:
formattedDate- format required: yyyy-MM-dd'T'HH:mm:ss.- Returns:
timestamp in millis UTC if formatted has been converted with success, 0 otherwise.
-
convertKaijuDateToMonthNYear
@NonNull() static Map.Entry<Integer, Integer> convertKaijuDateToMonthNYear(@Nullable() String formattedDate)
- Returns:
Entryif formattedDate is right.Entry is <1, 1970> if formattedDate is malformatted.the key contains month with leading zero if needed [01..12]value contains year.
-
getTimestamMs
static long getTimestamMs(@IntRange(from = 1, to = 12) int month, int year)
-
-
-
-