public final class DateTools
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
checkDate(java.lang.String timeString,
java.lang.String timeZone)
Determines if the provided timeString and timeZone are of a valid Date format.
|
static int |
dateComparison(java.util.Date o1,
java.util.Date o2,
boolean ascFlag)
Compare two Date objects, ignoring all but day, month and year information.
|
static int |
dateComparison(java.util.Date o1,
java.util.Date o2,
boolean ascFlag,
boolean dateOnly)
Compare two Date objects, with the option to use the date only,
cropping hours, minutes and seconds off the Date before comparing.
|
static java.util.Date |
getDate(java.lang.String timeString)
Try to create a Date object given a time string and a time zone.
|
static java.util.Date |
getDate(java.lang.String timeString,
java.lang.String timeZone)
Try to create a Date object given a time string and a time zone.
|
static java.lang.String |
getElapsedTimeString(long startTime)
Elapsed time string from start time to right now.
|
static java.lang.String |
getElapsedTimeString(long startTime,
long endTime)
Return the elapsed time in HH:mm:ss.
|
static java.lang.String |
getTimeStringWithOutTimeZone(java.util.Date date)
Return the date as a String without the time zone.
|
static java.lang.String |
getTimeStringWithTimeZone(java.util.Date date)
Return the date as a String with the time zone.
|
public static java.util.Date getDate(java.lang.String timeString, java.lang.String timeZone)
timeString
- string containing the timetimeZone
- the time zonepublic static java.util.Date getDate(java.lang.String timeString)
timeString
- string containing the timepublic static boolean checkDate(java.lang.String timeString, java.lang.String timeZone)
timeString
- string of the timetimeZone
- string of the time zone.public static java.lang.String getTimeStringWithTimeZone(java.util.Date date)
date
- the date to convert to a stringpublic static java.lang.String getTimeStringWithOutTimeZone(java.util.Date date)
date
- the date to convert to a stringpublic static java.lang.String getElapsedTimeString(long startTime, long endTime)
startTime
- the start time in millisecondsendTime
- the end time in millisecondspublic static java.lang.String getElapsedTimeString(long startTime)
startTime
- the start timepublic static int dateComparison(java.util.Date o1, java.util.Date o2, boolean ascFlag)
o1
- the first Date objecto2
- the second Date objectascFlag
- flag indicating sort direction, ascending or descendingpublic static int dateComparison(java.util.Date o1, java.util.Date o2, boolean ascFlag, boolean dateOnly)
o1
- the first Date objecto2
- the second Date objectascFlag
- flag indicating sort direction, ascending or descendingdateOnly
- flag indicating hours, minutes and seconds are ignoredCopyright (c) 2015 - Pittsburgh Science of Learning Center