Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.property
Interface DateTime

All Superinterfaces:
  Comparable<DateTime>, Serializable

    @Immutable
    public interface DateTime

extends Comparable<DateTime>, Serializable

An immutable date-time class that represents an instance in time. This class is designed to hide the horrible implementations of the JDK date and calendar classes, which are being overhauled (and replaced) under JSR-310, which will be based upon Joda-Time. This class serves as a stable migration path toward the new JSR 310 classes.

Method Summary
`int` | `getCenturyOfEra()` Get the era of this instance in time.
`int` | `getDayOfMonth()` Get the day of the month value of this instance in time.
`int` | `getDayOfWeek()` Get the day of the week value of this instance in time.
`int` | `getDayOfYear()` Get the day of the year of this instance in time.
`int` | `getEra()` Get the era of this instance in time.
`int` | `getHourOfDay()` Get the hour of the day of this instance in time.
`long` | `getMilliseconds()` Get the number of milliseconds from 1970-01-01T00:00Z.
`long` | `getMillisecondsInUtc()` Get the number of milliseconds from 1970-01-01T00:00Z with this time converted to UTC.
`int` | `getMillisOfSecond()` Get the milliseconds of the second value of this instance in time.
`int` | `getMinuteOfHour()` Get the minute of this instance in time.
`int` | `getMonthOfYear()` Get the month of the year of this instance in time.
`int` | `getSecondOfMinute()` Get the seconds of the minute value of this instance in time.
`String` | `getString()` Get the ISO-8601 representation of this instance in time.
`String` | `getTimeZoneId()` Get the identifier of the time zone in which this instant is defined
`int` | `getTimeZoneOffsetHours()` Get the number of hours that this time zone is offset from UTC.
`int` | `getWeekOfWeekyear()` Get the week of the weekyear of this instance in time.
`int` | `getWeekyear()` Get the era of this instance in time.
`int` | `getYear()` Get the era of this instance in time.
`int` | `getYearOfCentury()` Get the year of this century of this instance in time.
`int` | `getYearOfEra()` Get the year of the era of this instance in time.
`boolean` | `isAfter(DateTime other)` Return whether this date-time is later than the supplied date-time.
`boolean` | `isBefore(DateTime other)` Return whether this date-time is earlier than the supplied date-time.
`boolean` | `isSameAs(DateTime other)` Return whether this date-time is exactly the the same as the supplied date-time.
`DateTime` | `minus(long timeAmount, TimeUnit unit)` Subtract the specified about of time in the supplied units.
`DateTime` | `minusDays(int days)` Subtract the specified number of days from this time instant.
`DateTime` | `minusHours(int hours)` Subtract the specified number of hours from this time instant.
`DateTime` | `minusMillis(int milliseconds)` Subtract the specified number of milliseconds from this time instant.
`DateTime` | `minusMinutes(int minutes)` Subtract the specified number of minutes from this time instant.
`DateTime` | `minusMonths(int months)` Subtract the specified number of months from this time instant.
`DateTime` | `minusSeconds(int seconds)` Subtract the specified number of seconds from this time instant.
`DateTime` | `minusWeeks(int weeks)` Subtract the specified number of weeks from this time instant.
`DateTime` | `minusYears(int years)` Subtract the specified number of years from this time instant.
`DateTime` | `plus(long timeAmount, TimeUnit unit)` Add the specified about of time in the supplied units.
`DateTime` | `plusDays(int days)` Add the specified number of days from this time instant.
`DateTime` | `plusHours(int hours)` Add the specified number of hours from this time instant.
`DateTime` | `plusMillis(int milliseconds)` Add the specified number of milliseconds from this time instant.
`DateTime` | `plusMinutes(int minutes)` Add the specified number of minutes from this time instant.
`DateTime` | `plusMonths(int months)` Add the specified number of months from this time instant.
`DateTime` | `plusSeconds(int seconds)` Add the specified number of seconds from this time instant.
`DateTime` | `plusWeeks(int weeks)` Add the specified number of weeks from this time instant.
`DateTime` | `plusYears(int years)` Add the specified number of years from this time instant.
`Calendar` | `toCalendar()` Get this instance represented as a standard JDK `Calendar` instance, in the `default locale`.
`Calendar` | `toCalendar(Locale locale)` Get this instance represented as a standard JDK `Calendar` instance, in the specified `locale` .
`Date` | `toDate()` Get this instance represented as a standard JDK `Date` instance.
`GregorianCalendar` | `toGregorianCalendar()` Get this instance represented as a standard JDK `GregorianCalendar` instance.
`DateTime` | `toTimeZone(String timeZoneId)` Convert this time to the time zone given by the supplied identifier.
`DateTime` | `toUtcTimeZone()` Convert this time to the same instant in the UTC time zone.

Methods inherited from interface java.lang.Comparable
`compareTo`

Method Detail

### getString

    String getString()

  Get the ISO-8601 representation of this instance in time. The month-based ISO-8601 representation is the most common format of ISO8601, and is the format used in the XML standards for passing dates and times:

       yyyy-mm-ddTHH:MM:SS.SSSZ

  The fields are separated by dashes and consist of:
  - four digit year;
  - two digit month, where 01 is Janurary and 12 is December;
  - two digit day of month, from 01 to 31;
  - two digit hour, from 00 to 23;
  - two digit minute, from 00 to 59;
  - two digit second, from 00 to 59;
  - three decimal places for milliseconds, if required;
  - time zone offset of the form `�HH:mm` (or '0' if UTC)

  Returns:
    the string representation; never null

### getMilliseconds

    long getMilliseconds()

  Get the number of milliseconds from 1970-01-01T00:00Z. This value is consistent with the JDK `Date` and `Calendar` classes.

  Returns:
    the number of milliseconds from 1970-01-01T00:00Z

### getMillisecondsInUtc

    long getMillisecondsInUtc()

  Get the number of milliseconds from 1970-01-01T00:00Z with this time converted to UTC. This value is consistent with the JDK `Date` and `Calendar` classes.

  Returns:
    the number of milliseconds from 1970-01-01T00:00Z in the UTC time zone

### toDate

    Date toDate()

  Get this instance represented as a standard JDK `Date` instance. Note that this conversion loses the time zone information, as the standard JDK `Date` does not represent time zones.

  Returns:
    this instance in time as a JDK Date; never null

### toCalendar

    Calendar toCalendar()

  Get this instance represented as a standard JDK `Calendar` instance, in the `default locale`.

  Returns:
    this instance in time as a JDK Calendar; never null

### toCalendar

    Calendar toCalendar(Locale locale)

  Get this instance represented as a standard JDK `Calendar` instance, in the specified `locale` .

  Parameters:
    `locale` - the locale in which the Calendar instance is desired; may be null if the `default locale` is to be used.
  Returns:
    this instance in time as a JDK Calendar; never null

### toGregorianCalendar

    GregorianCalendar toGregorianCalendar()

  Get this instance represented as a standard JDK `GregorianCalendar` instance.

  Returns:
    this instance in time as a JDK GregorianCalendar; never null

### getEra

    int getEra()

  Get the era of this instance in time.

  Returns:
    the era

### getYear

    int getYear()

  Get the era of this instance in time.

  Returns:
    the era

### getWeekyear

    int getWeekyear()

  Get the era of this instance in time.

  Returns:
    the era

### getCenturyOfEra

    int getCenturyOfEra()

  Get the era of this instance in time.

  Returns:
    the era

### getYearOfEra

    int getYearOfEra()

  Get the year of the era of this instance in time.

  Returns:
    the year of the era

### getYearOfCentury

    int getYearOfCentury()

  Get the year of this century of this instance in time.

  Returns:
    the year of the century

### getMonthOfYear

    int getMonthOfYear()

  Get the month of the year of this instance in time.

  Returns:
    the month number

### getWeekOfWeekyear

    int getWeekOfWeekyear()

  Get the week of the weekyear of this instance in time.

  Returns:
    the week of the weekyear

### getDayOfYear

    int getDayOfYear()

  Get the day of the year of this instance in time.

  Returns:
    the day of the year

### getDayOfMonth

    int getDayOfMonth()

  Get the day of the month value of this instance in time.

  Returns:
    the day of the month

### getDayOfWeek

    int getDayOfWeek()

  Get the day of the week value of this instance in time.

  Returns:
    the day of the week

### getHourOfDay

    int getHourOfDay()

  Get the hour of the day of this instance in time.

  Returns:
    the hour of the day

### getMinuteOfHour

    int getMinuteOfHour()

  Get the minute of this instance in time.

  Returns:
    the minute of the hour

### getSecondOfMinute

    int getSecondOfMinute()

  Get the seconds of the minute value of this instance in time.

  Returns:
    the seconds of the minute

### getMillisOfSecond

    int getMillisOfSecond()

  Get the milliseconds of the second value of this instance in time.

  Returns:
    the milliseconds

### getTimeZoneOffsetHours

    int getTimeZoneOffsetHours()

  Get the number of hours that this time zone is offset from UTC.

  Returns:
    the number of hours

### getTimeZoneId

    String getTimeZoneId()

  Get the identifier of the time zone in which this instant is defined

  Returns:
    the time zone identifier; never null

### toUtcTimeZone

    DateTime toUtcTimeZone()

  Convert this time to the same instant in the UTC time zone.

  Returns:
    this instant in time in the specified time zone

### toTimeZone

    DateTime toTimeZone(String timeZoneId)

  Convert this time to the time zone given by the supplied identifier.

  Parameters:
    `timeZoneId` - the time zone identifier
  Returns:
    the instant in the specified time zone
  Throws:
    `IllegalArgumentException` - if the time zone identifier is null or is invalid

### isBefore

    boolean isBefore(DateTime other)

  Return whether this date-time is earlier than the supplied date-time.

  Parameters:
    `other` - the date-time to compare with
  Returns:
    true if this date-time is earliar than the other, or false otherwise
  See Also:
    `#compareTo(DateTime)`, `isSameAs(DateTime)`, `isAfter(DateTime)`

### isAfter

    boolean isAfter(DateTime other)

  Return whether this date-time is later than the supplied date-time.

  Parameters:
    `other` - the date-time to compare with
  Returns:
    true if this date-time is later than the other, or false otherwise
  See Also:
    `#compareTo(DateTime)`, `isBefore(DateTime)`, `isSameAs(DateTime)`

### isSameAs

    boolean isSameAs(DateTime other)

  Return whether this date-time is exactly the the same as the supplied date-time. This differs from `the equals method` in that it can be arbitrarily more strict, checking, for example, not only the logical equivalence of the other date time, but also arbitrary additional fields such as the time zone.

  Parameters:
    `other` - the date-time to compare with
  Returns:
    true if this date-time is later than the other, or false otherwise
  See Also:
    `#compareTo(DateTime)`, `isBefore(DateTime)`, `isAfter(DateTime)`

### minus

    DateTime minus(long timeAmount,
                   TimeUnit unit)

  Subtract the specified about of time in the supplied units.

  Parameters:
    `timeAmount` - the amount of time to subtract
    `unit` - the units of the amount of time; may not be null
  Returns:
    the instance in time the specified number of time before this instant

### minusDays

    DateTime minusDays(int days)

  Subtract the specified number of days from this time instant.

  Parameters:
    `days` - the number of days to subtract
  Returns:
    the instance in time the specified number of days before this instant

### minusHours

    DateTime minusHours(int hours)

  Subtract the specified number of hours from this time instant.

  Parameters:
    `hours` - the number of hours to subtract
  Returns:
    the instance in time the specified number of hours before this instant

### minusMillis

    DateTime minusMillis(int milliseconds)

  Subtract the specified number of milliseconds from this time instant.

  Parameters:
    `milliseconds` - the number of milliseconds to subtract
  Returns:
    the instance in time the specified number of milliseconds before this instant

### minusMinutes

    DateTime minusMinutes(int minutes)

  Subtract the specified number of minutes from this time instant.

  Parameters:
    `minutes` - the number of minutes to subtract
  Returns:
    the instance in time the specified number of minutes before this instant

### minusMonths

    DateTime minusMonths(int months)

  Subtract the specified number of months from this time instant.

  Parameters:
    `months` - the number of months to subtract
  Returns:
    the instance in time the specified number of months before this instant

### minusSeconds

    DateTime minusSeconds(int seconds)

  Subtract the specified number of seconds from this time instant.

  Parameters:
    `seconds` - the number of seconds to subtract
  Returns:
    the instance in time the specified number of seconds before this instant

### minusWeeks

    DateTime minusWeeks(int weeks)

  Subtract the specified number of weeks from this time instant.

  Parameters:
    `weeks` - the number of weeks to subtract
  Returns:
    the instance in time the specified number of weeks before this instant

### minusYears

    DateTime minusYears(int years)

  Subtract the specified number of years from this time instant.

  Parameters:
    `years` - the number of years to subtract
  Returns:
    the instance in time the specified number of years before this instant

### plus

    DateTime plus(long timeAmount,
                  TimeUnit unit)

  Add the specified about of time in the supplied units.

  Parameters:
    `timeAmount` - the amount of time to add
    `unit` - the units of the amount of time; may not be null
  Returns:
    the instance in time the specified number of time after this instant

### plusDays

    DateTime plusDays(int days)

  Add the specified number of days from this time instant.

  Parameters:
    `days` - the number of days to add
  Returns:
    the instance in time the specified number of days after this instant

### plusHours

    DateTime plusHours(int hours)

  Add the specified number of hours from this time instant.

  Parameters:
    `hours` - the number of hours to add
  Returns:
    the instance in time the specified number of hours after this instant

### plusMillis

    DateTime plusMillis(int milliseconds)

  Add the specified number of milliseconds from this time instant.

  Parameters:
    `milliseconds` - the number of milliseconds to add
  Returns:
    the instance in time the specified number of milliseconds after this instant

### plusMinutes

    DateTime plusMinutes(int minutes)

  Add the specified number of minutes from this time instant.

  Parameters:
    `minutes` - the number of minutes to add
  Returns:
    the instance in time the specified number of minutes after this instant

### plusMonths

    DateTime plusMonths(int months)

  Add the specified number of months from this time instant.

  Parameters:
    `months` - the number of months to add
  Returns:
    the instance in time the specified number of months after this instant

### plusSeconds

    DateTime plusSeconds(int seconds)

  Add the specified number of seconds from this time instant.

  Parameters:
    `seconds` - the number of seconds to add
  Returns:
    the instance in time the specified number of seconds after this instant

### plusWeeks

    DateTime plusWeeks(int weeks)

  Add the specified number of weeks from this time instant.

  Parameters:
    `weeks` - the number of weeks to add
  Returns:
    the instance in time the specified number of weeks after this instant

### plusYears

    DateTime plusYears(int years)

  Add the specified number of years from this time instant.

  Parameters:
    `years` - the number of years to add
  Returns:
    the instance in time the specified number of years after this instant

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.