public final class InrixDateUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
INRIX_DATE_FORMAT
The INRIX date format, using default time zone.
|
static String |
INRIX_DATE_FORMAT_FRACTIONAL_SECONDS
The INRIX date format, including fractional seconds.
|
| Modifier and Type | Method and Description |
|---|---|
static Date |
convertDateToEOD(Date date)
Convert date to the end of a day.
|
static Date |
convertDateToSOD(Date date)
Convert date to the start of a day.
|
static Date |
getDateFromString(String str)
Parses the date as a string and returns the date object.
|
static Date |
getDateFromString(String str,
boolean fractionalSeconds)
Parses the date as a string and returns the date object.
|
static int |
getDayOffset(Date start,
Date end)
Get the offset between two dates in days.
|
static List<Date> |
getEncompassingDates(Date start,
Date end)
Gets the list of dates that are included in the given range.
|
static Calendar |
getNowAsUtc()
Utility method which returns the current local time (on the device) as timezone "UTC" useful
for when dealing with
Schedules. |
static String |
getStringFromDateUtc(Date date)
Converts the specified UTC date to an INRIX time format string.
|
static String |
getStringFromDateUtc(Date date,
boolean fractionalSeconds)
Converts the specified UTC date to an INRIX time format string.
|
static boolean |
isSameDay(Date date1,
Date date2)
Compares to see if two dates fall on the same day, irrespective of locale.
|
static Date |
round(Date date,
int offsetMinutes)
Round the specified date to the nearest minute offset.
|
static Date |
roundDown(Date date,
int offsetMinutes)
Round down specified date to the nearest value.
|
static Date |
roundUp(Date date,
int offsetMinutes)
Round up specified date to the nearest value.
|
public static final String INRIX_DATE_FORMAT
public static final String INRIX_DATE_FORMAT_FRACTIONAL_SECONDS
public static Date getDateFromString(String str) throws ParseException
str - The date as a string in INRIX time format.ParseException - when str is not in the correct format.public static Date getDateFromString(String str, boolean fractionalSeconds) throws ParseException
str - The date as a string in INRIX time format.fractionalSeconds - Whether the string includes fractional seconds or not.ParseException - when str is not in the correct format.public static String getStringFromDateUtc(Date date)
date - The UTC date to be converted.null if date is
null.public static String getStringFromDateUtc(Date date, boolean fractionalSeconds)
date - The UTC date to be converted.fractionalSeconds - Whether the string should include fractional seconds or not.null if date is null.public static Date roundUp(Date date, int offsetMinutes)
date - Target date.offsetMinutes - Nearest minutes offset.public static Date roundDown(Date date, int offsetMinutes)
date - Target date.offsetMinutes - Nearest minutes offset.public static Date round(Date date, int offsetMinutes)
date - Target date.offsetMinutes - Nearest minutes offset.public static Calendar getNowAsUtc()
Schedules.public static Date convertDateToSOD(Date date)
date - The date to convert.public static Date convertDateToEOD(Date date)
date - The date to convert.public static int getDayOffset(Date start, Date end)
start - The starting date to evaluate.end - The ending date to evaluate.public static List<Date> getEncompassingDates(Date start, Date end)
start - The starting date to evaluate.end - The ending date to evaluate.Copyright © 2013-2016 INRIX, Inc. All Rights Reserved.