Class UtilitiesDateFormatter
-
- All Implemented Interfaces:
public class UtilitiesDateFormatter
-
-
Field Summary
Fields Modifier and Type Field Description public final static String
DATE_FORMAT_WITH_SECONDS
-
Constructor Summary
Constructors Constructor Description UtilitiesDateFormatter()
-
Method Summary
Modifier and Type Method Description static String
convertDateToReadableDate(Date date)
static String
convertTimestampToReadableDate(long timestamp)
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. static String
convertTimestampToReadableDate(long timestamp, int dateFormat)
convert timestamp to a readable date, with desired format for date, values accepted: DateFormat.FULL/LONG/.../SHORT. 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. static String
convertTimestampToKaijuDateUTC(long timestampMs)
Convert a timestamp to readable without any timezone shifting. static long
convertKaijuDateToTimestamp(String formattedDate)
Convert date returned by Kaiju to timestamp in milliseconds. static Map.Entry<Integer, Integer>
convertKaijuDateToMonthNYear(@Nullable() String formattedDate)
static long
getTimestamMs(@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)
-
-
-
-