public class TimeUtils extends Object
Modifier and Type | Field and Description |
---|---|
static java.time.format.DateTimeFormatter |
DATE_FORMATTER |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkTimeInRangeWithSkew(Date timeToCheck,
Date startDate,
Date endDate,
int skewInMinutes)
Checks that a date falls in the interval allowing for a certain clock skew expressed in
minutes.
|
static Date |
parseDate(String date)
Parses a date from string
|
public static boolean checkTimeInRangeWithSkew(Date timeToCheck, Date startDate, Date endDate, int skewInMinutes)
timeToCheck
- the time to be checkedstartDate
- the start date of the time rangeendDate
- the end date of the time rangeskewInMinutes
- the clock skew in minutes to take into accounttrue
, if the time is in the given range, false
otherwiseIllegalArgumentException
- if passed an illegal time rangepublic static Date parseDate(String date)
date
- the date string representation;NullPointerException
- if date is nulljava.time.format.DateTimeParseException
- if the date is in the wrong formatCopyright © 2020. All rights reserved.