@Immutable public class DateType extends Object
| Constructor and Description |
|---|
DateType(CalendarDate date)
Constructor using a CalendarDate
|
| Modifier and Type | Method and Description |
|---|---|
DateType |
add(TimeDuration d) |
DateType |
add(TimeUnit d) |
boolean |
before(DateType d)
Is this date before the given date.
|
boolean |
equals(Object o) |
CalendarDate |
getCalendarDate()
Get the CalendarDate, may be null if isBlank().
|
String |
getFormat()
Get the SimpleDateFormat format for parsing the text, passed into the constructor.
|
String |
getText()
Get the original text passed to the constructor.
|
String |
getType()
Get the type of Date, passed into the constructor.
|
int |
hashCode() |
boolean |
isBlank()
Was blank text passed to the constructor?
|
boolean |
isPresent()
Does this represent the present time?
|
static DateType |
parse(String text)
Parse text to get a DateType.
|
static DateType |
parse(String text,
String format,
String type,
Calendar calendar)
Parse text to get a DateType.
|
static DateType |
present()
Get the DateType representing the present time.
|
DateType |
subtract(TimeDuration d) |
DateType |
subtract(TimeUnit d) |
String |
toDateString()
Same as CalendarDateFormatter.toDateString
|
String |
toDateTimeString()
Same as CalendarDateFormatter.toDateTimeStringISO
|
String |
toString() |
public DateType(CalendarDate date)
date - the given CalendarDatepublic static DateType present()
public static DateType parse(String text) throws ParseException
text - string representationParseExceptionpublic static DateType parse(@Nullable String text, @Nullable String format, @Nullable String type, @Nullable Calendar calendar) throws ParseException
text - string representationformat - using java.text.SimpleDateFormat, or nulltype - type of date, or nullcalendar - the calendar, or null for defaultParseException - or IllegalArgumentException if error parsing text@Nullable public CalendarDate getCalendarDate()
public boolean isPresent()
public boolean isBlank()
public String getText()
@Nullable public String getFormat()
public String toDateString()
public String toDateTimeString()
public boolean before(DateType d)
d - test against this datepublic DateType add(TimeDuration d)
public DateType subtract(TimeDuration d)