parseComplexTime
public static long parseComplexTime(String str,
long baseTime,
boolean futureTime)
throws ParseException
Parse times in a 'natural language' fashion. The following types of times/dates are supported: 'now' - Returns
the 'basetime' that is passed in 'now - 1 day' - Returns 1 day prior to the base time 'yesterday' - Returns
basetime - 1 day 'tomorrow' - Returns basetime + 1 day 'monday' - Returns the previous monday if futureTime is
set to false, else true 'monday + 12 hours' - Depending on futureTime returns different mondays at noon 'march +
4 days' - 4 days into March '3:00' - Parse error -- not enough info '3:00pm' - Future 3 if futureTime is set
'12/24/02 9:00pm' - Absolute time
- Parameters:
str - String to parsebaseTime - Basetime to use when calculating relative times (i.e. now - 3 days)futureTime - When there is some ambiguity as to the time, default to the time in the future. I.e in the
case where someone says, "noon" and the time is currently 1:00, does he mean the noon that
just passed, or the upcoming noon?
- Returns:
- milliseconds from the epoch representing the parsed time
- Throws:
ParseException