public class DateUtils extends Object
Created by Jeff Gaynor
on May 18, 2011 at 2:40:19 PM
Modifier and Type | Field and Description |
---|---|
static long |
MAX_TIMEOUT |
Constructor and Description |
---|
DateUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
checkTimestamp(String token)
Given a token, this will take the date and check that it lies within the
MAX_TIMEOUT range, throwing an InvalidTimestampException
if it does not. |
static void |
checkTimestamp(String token,
long maxTime)
Check the timestamp for the given token.
|
static boolean |
compareDates(Date date0,
Date date1)
Date equality taking into account that one or both of these might be SQL timestamp objects.
|
static boolean |
equals(Date date1,
Date date2)
This compares the two dates down to the nearest millisecond.
|
static Date |
getDate(String token)
Get the date from a token.
|
static Date |
getDate(URI token)
Parse and retrieve the date from a token.
|
static Date |
sqlTSToDate(Timestamp timestamp)
SQL timestamps store their milliseconds slightly differently than dates, so equality will always
fail.
|
public static Date getDate(URI token)
token
- public static Date getDate(String token)
token
- public static void checkTimestamp(String token, long maxTime)
token
- maxTime
- public static void checkTimestamp(String token)
MAX_TIMEOUT
range, throwing an InvalidTimestampException
if it does not.token
- public static Date sqlTSToDate(Timestamp timestamp)
timestamp
- public static boolean compareDates(Date date0, Date date1)
date0
- date1
- public static boolean equals(Date date1, Date date2)
date1
- date2
- Copyright © 2019. All Rights Reserved.