public class DateType
extends java.lang.Object
Constructor and Description |
---|
DateType()
no argument constructor for beans
|
DateType(boolean isPresent,
java.util.Date date)
Constructor using a java.util.Date
|
DateType(CalendarDate date)
Constructor using a java.util.CalendarDate
|
DateType(DateType src)
copy constructor
|
DateType(java.lang.String text,
java.lang.String format,
java.lang.String type)
Constructor.
|
DateType(java.lang.String text,
java.lang.String format,
java.lang.String type,
Calendar cal2)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DateType |
add(TimeDuration d) |
DateType |
add(TimeUnit d) |
boolean |
after(java.util.Date d)
Is this date after the given date.
|
boolean |
before(java.util.Date d)
Is this date before the given date.
|
boolean |
before(DateType d)
Is this date before the given date.
|
boolean |
equals(java.lang.Object o) |
CalendarDate |
getCalendarDate()
Get this as a CalendarDate
|
java.lang.String |
getFormat()
Get the SimpleDateFormat format for parsing the text.
|
java.lang.String |
getText()
Get a text representation.
|
java.lang.String |
getType()
Get the type of Date.
|
int |
hashCode() |
boolean |
isBlank()
Was blank text passed to the constructor.
|
boolean |
isPresent()
Does this represent the present time.
|
DateType |
setType(java.lang.String type)
Set the type of Date.
|
DateType |
subtract(TimeDuration d) |
DateType |
subtract(TimeUnit d) |
java.lang.String |
toDateString()
Same as DateFormatter.toDateOnlyString()
|
java.lang.String |
toDateTimeString()
Same as CalendarDateFormatter.toDateTimeStringISO
|
java.lang.String |
toDateTimeStringISO()
Get ISO formatted string
|
java.lang.String |
toString()
String representation
|
public DateType()
public DateType(boolean isPresent, java.util.Date date)
isPresent
- if true, this represents the "present time"date
- the given Datepublic DateType(CalendarDate date)
date
- the given CalendarDatepublic DateType(DateType src)
src
- copy from herepublic DateType(java.lang.String text, java.lang.String format, java.lang.String type) throws java.text.ParseException
text
- string representationformat
- using java.text.SimpleDateFormat, or nulltype
- type of date, or nulljava.text.ParseException
- if error parsing textpublic DateType(java.lang.String text, java.lang.String format, java.lang.String type, Calendar cal2) throws java.text.ParseException
text
- string representationformat
- using java.text.SimpleDateFormat, or nulltype
- type of date, or nullcal2
- ucar.nc2.time.Calendar of date, or nulljava.text.ParseException
- if error parsing textpublic DateType add(TimeDuration d)
public boolean after(java.util.Date d)
d
- test against this datepublic boolean before(java.util.Date d)
d
- test against this datepublic boolean before(DateType d)
d
- test against this datepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public CalendarDate getCalendarDate()
public java.lang.String getFormat()
public java.lang.String getText()
public java.lang.String getType()
public int hashCode()
hashCode
in class java.lang.Object
public boolean isBlank()
public boolean isPresent()
public DateType setType(java.lang.String type)
type
- type of Datepublic DateType subtract(TimeDuration d)
public java.lang.String toDateString()
public java.lang.String toDateTimeString()
public java.lang.String toDateTimeStringISO()
public java.lang.String toString()
toString
in class java.lang.Object