|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvisad.ThingImpl
visad.DataImpl
visad.Scalar
visad.Real
visad.DateTime
public final class DateTime
DateTime is a class of objects for holding date and time information. DateTime objects are immutable.
Internally, the object uses seconds since the epoch (1970-01-01 00:00:00Z) as the temporal reference.
System.currentTimeMillis()
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class visad.DataImpl |
---|
DataImpl.Syncher |
Field Summary |
---|
Fields inherited from interface visad.Data |
---|
ABS, ACOS, ACOS_DEGREES, ADD, ASIN, ASIN_DEGREES, ATAN, ATAN_DEGREES, ATAN2, ATAN2_DEGREES, CEIL, COS, COS_DEGREES, DEGREES_TO_RADIANS, DEPENDENT, DIVIDE, EXP, FLOOR, INDEPENDENT, INV_ATAN2, INV_ATAN2_DEGREES, INV_DIVIDE, INV_POW, INV_REMAINDER, INV_SUBTRACT, LOG, MAX, MIN, MULTIPLY, NEAREST_NEIGHBOR, NEGATE, NO_ERRORS, NOP, POW, RADIANS_TO_DEGREES, REMAINDER, RINT, ROUND, SIN, SIN_DEGREES, SQRT, SUBTRACT, TAN, TAN_DEGREES, WEIGHTED_AVERAGE |
Constructor Summary | |
---|---|
DateTime()
Construct a DateTime object and initialize it to the current date/time. |
|
DateTime(java.util.Date date)
Construct a DateTime object and initialize it with a Java date. |
|
DateTime(double seconds)
Construct a DateTime object and initialize it with the seconds since January 1, 1970 00:00:00Z. |
|
DateTime(int year,
int day,
double seconds)
Construct a DateTime object initialized with a year, day of the year, and seconds in the day. |
|
DateTime(Real real)
Construct a DateTime object and initialize it using a VisAD Real. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object oo)
Implement Comparable interface |
static DateTime |
createDateTime(java.lang.String dateString)
Create a DateTime object from a string specification |
static DateTime |
createDateTime(java.lang.String dateString,
java.lang.String format)
Create a DateTime object from a string specification using the supplied pattern and default timezone. |
static DateTime |
createDateTime(java.lang.String dateString,
java.lang.String format,
java.util.TimeZone timezone)
Create a DateTime object from a string specification using the supplied pattern and timezone. |
java.lang.String |
dateString()
Return a string representing the "date" portion of this DateTime |
java.lang.String |
formattedString(java.lang.String pattern,
java.util.TimeZone timezone)
Return a string representation of this DateTime from a user specified format. |
static Real |
fromYearDaySeconds(int year,
int day,
double seconds)
Return a Real object whose value is the seconds since the Epoch initialized with a year, day of the year, and seconds in the day. |
static java.lang.String |
getFormatPattern()
Return the format pattern used in the output of the toString() method. |
static java.util.TimeZone |
getFormatTimeZone()
Return the TimeZone used in the output of the toString() method. |
Real |
getReal()
Get a Real representing the number of seconds since * the epoch. |
static void |
main(java.lang.String[] args)
run 'java visad.DateTime' to test the DateTime class |
static Gridded1DDoubleSet |
makeTimeSet(DateTime[] times)
Create a Gridded1DDoubleSet from an array of DateTimes |
static Gridded1DDoubleSet |
makeTimeSet(double[] times)
Create a Gridded1DDoubleSet from an array of doubles of seconds since the epoch. |
static void |
resetFormat()
Reset the format of the output of the toString() method to the default - |
static void |
setFormatPattern(java.lang.String pattern)
Set the format of the output of the toString() method. |
static void |
setFormatTimeZone(java.util.TimeZone tz)
Set the TimeZone of the output of the toString() method. |
static DateTime[] |
timeSetToArray(Gridded1DSet timeSet)
Create an array of DateTimes from a Gridded1DSet of times. |
java.lang.String |
timeString()
Return a string representing the "time" portion of this DateTime |
java.lang.String |
toString()
Return a string representation of this DateTime. |
java.lang.String |
toValueString()
Gets a string that represents just the value portion of this DateTime -- but with full semantics. |
Methods inherited from class visad.Real |
---|
adjustSamplingError, binary, cloneButUnit, cloneButValue, computeRanges, equals, getError, getUnit, getValue, getValue, hashCode, isMissing, longString, unary |
Methods inherited from class visad.Scalar |
---|
addReference, clone, removeReference |
Methods inherited from class visad.DataImpl |
---|
__add__, __add__, __div__, __div__, __mod__, __mod__, __mul__, __mul__, __neg__, __pow__, __pow__, __sub__, __sub__, abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, notifyReferences, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface visad.Data |
---|
abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary |
Methods inherited from interface visad.Thing |
---|
addReference, removeReference |
Constructor Detail |
---|
public DateTime(Real real) throws VisADException
real
- Real value in a temporal unit.
VisADException
- unit conversion problempublic DateTime(double seconds) throws VisADException
seconds
- number of seconds since 1970-01-01 00:00:00Z.
VisADException
- unit conversion problempublic DateTime(java.util.Date date) throws VisADException
date
- date object
VisADException
- unit conversion problempublic DateTime() throws VisADException
VisADException
- unit conversion problempublic DateTime(int year, int day, double seconds) throws VisADException
year
- year - use negative year to indicated BCday
- day of the yearseconds
- seconds in the day
VisADException
- invalid day or seconds. Days must be
greater than zero and seconds must be greater
than zero and less than or equal to the
seconds in a day.Method Detail |
---|
public static Real fromYearDaySeconds(int year, int day, double seconds) throws VisADException
year
- year - use negative year to indicated BCday
- day of the yearseconds
- seconds in the day
VisADException
- invalid day or seconds. Days must be
greater than zero and seconds must be greater
than zero and less than or equal to the
seconds in a day.public Real getReal()
public java.lang.String toString()
toString
in interface RealIface
toString
in class Real
setFormatPattern(java.lang.String)
,
setFormatTimeZone(java.util.TimeZone)
public java.lang.String toValueString()
toValueString
in interface RealIface
toValueString
in class Real
public java.lang.String formattedString(java.lang.String pattern, java.util.TimeZone timezone)
pattern
- time format stringtimezone
- time zone to use
SimpleDateFormat
,
TimeZone
public java.lang.String dateString()
public java.lang.String timeString()
public static void setFormatPattern(java.lang.String pattern)
pattern
- time format stringIf you want to use a time zone other than the default,
,
setFormatTimeZone(java.util.TimeZone)
public static java.lang.String getFormatPattern()
SimpleDateFormat
public static void setFormatTimeZone(java.util.TimeZone tz)
tz
- time zoneTimeZone
public static java.util.TimeZone getFormatTimeZone()
public static void resetFormat()
public static DateTime createDateTime(java.lang.String dateString) throws VisADException
dateString
- date string specification in format pattern
defined for DateTime in this JVM
VisADException
- formatting problemsetFormatPattern(java.lang.String)
public static DateTime createDateTime(java.lang.String dateString, java.lang.String format) throws VisADException
dateString
- date string specificationformat
- string
VisADException
- formatting problempublic static DateTime createDateTime(java.lang.String dateString, java.lang.String format, java.util.TimeZone timezone) throws VisADException
dateString
- date string specificationformatPattern
- format stringtimezone
- TimeZone to use
VisADException
- formatting problempublic int compareTo(java.lang.Object oo)
compareTo
in interface java.lang.Comparable
compareTo
in interface RealIface
compareTo
in class Real
oo
- Object for comparison - should be DateTime
ErrorEstimate.compareTo()
method is used
to break the tie.public static Gridded1DDoubleSet makeTimeSet(DateTime[] times) throws VisADException
times
- array of DateTimes. Array cannot be null or only
have one entry.
VisADException
- couldn't create the GriddedDoubleSetpublic static Gridded1DDoubleSet makeTimeSet(double[] times) throws VisADException
times
- array of times in seconds since the epoch. Array
cannot be null or only have one entry.
VisADException
- couldn't create the GriddedDoubleSetpublic static DateTime[] timeSetToArray(Gridded1DSet timeSet) throws VisADException
timeSet
- Gridded1DSet of times
VisADException
- invalid time set or couldn't create DateTimespublic static void main(java.lang.String[] args) throws VisADException
VisADException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |