public class ISODateInstance
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ISODateInstance.DateField
Enum for the fields *
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BOUNDED_RANGE |
static int |
DAY_OF_HALF_MONTH |
static java.util.Map<java.lang.Integer,java.lang.Integer> |
daysPerMonth |
static int |
LAST_DAY_OF_MONTH |
static java.lang.String |
LAST_MONTH_OF_YEAR |
static java.lang.String |
MONTH_OF_HALF_YEAR |
static java.lang.String |
NO_RANGE |
static java.lang.String |
OPEN_RANGE_AFTER |
static java.lang.String |
OPEN_RANGE_BEFORE |
static java.util.Map<java.lang.String,Pair<ISODateInstance.DateField,java.lang.Integer>> |
relativeDateMap
Map for mapping a relativeDate String to a pair with the field that should be modified and the amount to modify it *
|
Constructor and Description |
---|
ISODateInstance()
Creates an empty date instance; you probably
don't want this in most cases.
|
ISODateInstance(ISODateInstance start,
ISODateInstance end)
Constructor for a range of dates, beginning at date start and finishing at date end
|
ISODateInstance(ISODateInstance referenceDate,
java.lang.String relativeDate)
Construct a new ISODate based on its relation to a referenceDate.
|
ISODateInstance(java.lang.String date)
Takes a string that represents a date, and attempts to
normalize it into ISO 8601-compatible format.
|
ISODateInstance(java.lang.String date,
java.lang.String openRangeMarker) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(ISODateInstance other)
Returns true iff this date
contains the date represented by other.
|
boolean |
extractDay(java.lang.String inputDate) |
boolean |
extractMonth(java.lang.String inputDate) |
boolean |
extractWeekday(java.lang.String inputDate)
This is a backup method if everything else fails.
|
boolean |
extractYear(java.lang.String inputDate) |
static ISODateInstance |
fromDateString(java.lang.String date)
Takes a string already formatted in ISODateInstance format
(such as one previously written out using toString) and creates
a new date instance from it
|
java.lang.String |
getDateString()
Provided for backwards compatibility with DateInstance;
returns the same thing as toString()
|
java.lang.String |
getEndDate()
Returns this date or if it is a range,
the date the range ends.
|
java.lang.String |
getStartDate()
Returns this date or if it is a range,
the date the range starts.
|
boolean |
isAfter(java.lang.String dateString)
Returns true if this date instance is after
the given dateString.
|
static boolean |
isCompatible(java.lang.String date1,
java.lang.String date2)
Returns true iff date1 could represent the same value as date2
e.g.
|
boolean |
isCompatibleDate(ISODateInstance other) |
boolean |
isDayCompatible(ISODateInstance other)
Looks if the days for the two dates are compatible.
|
boolean |
isMonthCompatible(ISODateInstance other)
Looks if the months for the two dates are compatible.
|
boolean |
isRange()
Returns true iff this date represents a range
The range must have at least a start or end
date, but is not guaranteed to have both
|
boolean |
isUnparseable()
Returns true iff we were unable to parse the input
String associated with this date; in that case,
we just store the input string and shortcircuit
all of the comparison methods
|
boolean |
isYearCompatible(ISODateInstance other)
Looks if the years for the two dates are compatible.
|
static void |
main(java.lang.String[] args)
For testing only
|
java.lang.String |
toString() |
public static final java.lang.String OPEN_RANGE_AFTER
public static final java.lang.String OPEN_RANGE_BEFORE
public static final java.lang.String BOUNDED_RANGE
public static final java.lang.String NO_RANGE
public static final int DAY_OF_HALF_MONTH
public static final int LAST_DAY_OF_MONTH
public static final java.lang.String MONTH_OF_HALF_YEAR
public static final java.lang.String LAST_MONTH_OF_YEAR
public static final java.util.Map<java.lang.String,Pair<ISODateInstance.DateField,java.lang.Integer>> relativeDateMap
public static final java.util.Map<java.lang.Integer,java.lang.Integer> daysPerMonth
public ISODateInstance()
public ISODateInstance(java.lang.String date)
public ISODateInstance(java.lang.String date, java.lang.String openRangeMarker)
public ISODateInstance(ISODateInstance start, ISODateInstance end)
public ISODateInstance(ISODateInstance referenceDate, java.lang.String relativeDate)
public static ISODateInstance fromDateString(java.lang.String date)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDateString()
public boolean isRange()
public boolean isUnparseable()
public java.lang.String getStartDate()
public java.lang.String getEndDate()
public static boolean isCompatible(java.lang.String date1, java.lang.String date2)
public boolean contains(ISODateInstance other)
public boolean isAfter(java.lang.String dateString)
public boolean isCompatibleDate(ISODateInstance other)
public boolean isYearCompatible(ISODateInstance other)
public boolean isMonthCompatible(ISODateInstance other)
public boolean isDayCompatible(ISODateInstance other)
public boolean extractYear(java.lang.String inputDate)
public boolean extractMonth(java.lang.String inputDate)
public boolean extractDay(java.lang.String inputDate)
public boolean extractWeekday(java.lang.String inputDate)
public static void main(java.lang.String[] args)