|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectucar.nc2.units.DateUnit
public class DateUnit
Handles udunits dates, represented as "n units of time since reference date" eg "1203 days since 1970-01-01 00:00:00".
This is a wrapper around ucar.units package. It tracks the value, the base time unit, and the date origin seperately.
| Constructor Summary | |
|---|---|
DateUnit(double value,
String timeUnitString,
Date since)
Constructor that takes a value, timeUnitString, and a Date since |
|
DateUnit(String text)
Constructor. |
|
| Method Summary | |
|---|---|
Date |
getDate()
Get the equivilent java.util.Date. |
Date |
getDateOrigin()
Get the origin Date. |
static Date |
getStandardDate(String text)
Create a java.util.Date from this udunits String. |
static Date |
getStandardOrISO(String text)
Create a java.util.Date from a udunit or ISO String. |
TimeUnit |
getTimeUnit()
For udunit dates, get the time unit. |
String |
getTimeUnitString()
For udunit dates, get the time unit only, as a String, eg "secs" or "days" |
String |
getUnitsString()
The udunits string, but no value, ie its a base unit. |
static DateUnit |
getUnixDateUnit()
|
static void |
main(String[] args)
|
Date |
makeDate(double val)
Create a Date from this base unit and the given value. |
String |
makeStandardDateString(double value)
Make a standard GMT string representation from this unit and given value. |
double |
makeValue(Date date)
Create the equivilent value from this base unit and the given Date. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DateUnit(String text)
throws Exception
text - udunits String, eg 3 secs since 1991-01-01T03:12
Exception - if malformed String.
public DateUnit(double value,
String timeUnitString,
Date since)
throws Exception
value - number of time unitstimeUnitString - eg "secs"since - date since, eg "secs since 1970-01-01T00:00:00Z"
Exception - if not valid time unit.| Method Detail |
|---|
public static Date getStandardDate(String text)
text - a udunit string.
[number] (units) since [-]Y[Y[Y[Y]]]-MM-DD[(T| )hh[:mm[:ss[.sss*]]][ [+|-]hh[[:]mm]]]
public static Date getStandardOrISO(String text)
text - a udunit or ISO string.
getStandardDate(java.lang.String),
DateFormatter.getISODate(java.lang.String)public static DateUnit getUnixDateUnit()
public Date getDateOrigin()
public String getTimeUnitString()
public TimeUnit getTimeUnit()
public Date getDate()
public Date makeDate(double val)
val - value in the units of this base unit, eg sec since base date
public double makeValue(Date date)
date - to convert.
public String makeStandardDateString(double value)
value - of time in these units.
public String toString()
toString in class Objectpublic String getUnitsString()
public static void main(String[] args)
throws Exception
Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||