public class DateUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ALLOWED_DATE_FORMAT |
Constructor and Description |
---|
DateUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
convertDateToString(Date date)
Convert Date to allowed format
|
static Date |
convertToDate(String date)
Convert from supported format to Date
|
static String |
convertToReadableTime(Long timestamp)
Milliseconds to readable format in current server timezone
|
static Long |
convertToTimestamp(String time,
String format)
Convert time in given format to milliseconds
|
static Long |
getDateDifferenceInMinutes(Date oldTime)
Get difference in minutes between old date and now
|
static Date |
getDateSpecifiedTimeAgo(String periodString)
Returns a date given period before now
|
static boolean |
isFutureTime(Date time)
Check if given time is in the future
|
public static final String ALLOWED_DATE_FORMAT
public static String convertToReadableTime(Long timestamp)
timestamp
- public static Long convertToTimestamp(String time, String format)
public static Date convertToDate(String date) throws ParseException
date
- ParseException
public static String convertDateToString(Date date) throws ParseException
date
- ParseException
public static Long getDateDifferenceInMinutes(Date oldTime)
oldTime
- public static boolean isFutureTime(Date time)
time
- Copyright © 2022 Apache Software Foundation. All rights reserved.