Package org.gvsig.timesupport
Interface RelativeInstant
- All Known Subinterfaces:
EditableRelativeInstant
A relative instant is defined like an instant in the datetime continuum specified as a number of milliseconds from 1970-01-01T00:00Z. This definition of milliseconds is consistent with that of the JDK in Date or Calendar.
It contains also a Chronology which determines how the millisecond
instant value is converted into the date time fields. The default Chronology
can be set using the TimeSupportManager class. (e.g: 1st January 2010)
A huge part of the documentation of this class has been retrieved from the joda-time library.
- Version:
- $Id$
- Author:
- gvSIG team
-
Method Summary
Modifier and TypeMethodDescriptionintCompares this object with the specified object for ascending millisecond instant order.intGet the day of month field value.Get an editable copy used to edit other instance of a relative instant.intGet the hour of day field value.intGet the millis of second field value.intGet the minute of day field value.intGet the minute of hour field value.intGet the month of year field value.intGet the second of day field value.intGet the second of minute field value.intgetYear()Get the year field value.toDate()Get the date time as ajava.util.Date.longtoMillis()Gets the milliseconds of the datetime instant from the Java epoch of 1970-01-01T00:00:00Z.Methods inherited from interface org.gvsig.tools.lang.Cloneable
cloneMethods inherited from interface org.gvsig.timesupport.Time
getChronology, intersects, isAbsolute, isInstant, isInterval, isRelative
-
Method Details
-
toDate
Date toDate()Get the date time as ajava.util.Date.The
Dateobject created has exactly the same millisecond instant as this object.- Returns:
- a Date initialised with this relative instant
-
compareTo
Compares this object with the specified object for ascending millisecond instant order. This ordering is inconsistent with equals, as it ignores the Chronology.- Parameters:
instant- a readable instant to check against- Returns:
- negative value if this is less, 0 if equal, or positive value if greater
-
toMillis
long toMillis()Gets the milliseconds of the datetime instant from the Java epoch of 1970-01-01T00:00:00Z.- Returns:
- the number of milliseconds since 1970-01-01T00:00:00Z
-
getYear
int getYear()Get the year field value.- Returns:
- the year
-
getMonthOfYear
int getMonthOfYear()Get the month of year field value.- Returns:
- the month of year
-
getDayOfMonth
int getDayOfMonth()Get the day of month field value.- Returns:
- the day of month
-
getHourOfDay
int getHourOfDay()Get the hour of day field value.- Returns:
- the hour of month
-
getMinuteOfDay
int getMinuteOfDay()Get the minute of day field value.- Returns:
- the minute of day
-
getMinuteOfHour
int getMinuteOfHour()Get the minute of hour field value.- Returns:
- the minute of hour
-
getSecondOfDay
int getSecondOfDay()Get the second of day field value.- Returns:
- the second of day
-
getSecondOfMinute
int getSecondOfMinute()Get the second of minute field value.- Returns:
- the second of minute
-
getMillisOfSecond
int getMillisOfSecond()Get the millis of second field value.- Returns:
- the millis of second
-
getEditableCopy
EditableRelativeInstant getEditableCopy()Get an editable copy used to edit other instance of a relative instant. The new copy is initialized with the values of this intant.- Returns:
- a copy to edit the instant
-