public interface DateTime extends Comparable<DateTime>, Serializable
Modifier and Type | Method and Description |
---|---|
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)
|
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.
|
compareTo
String getString()
yyyy-mm-ddTHH:MM:SS.SSSZThe fields are separated by dashes and consist of:
�HH:mm
(or '0' if UTC)long getMilliseconds()
Date
and Calendar
classes.long getMillisecondsInUtc()
Date
and Calendar
classes.Date toDate()
Date
instance. Note that this conversion loses the time
zone information, as the standard JDK Date
does not represent time zones.Calendar toCalendar()
Calendar
instance, in the default locale
.Calendar toCalendar(Locale locale)
locale
- the locale in which the Calendar instance is desired; may be null if the default
locale
is to be used.GregorianCalendar toGregorianCalendar()
GregorianCalendar
instance.int getEra()
int getYear()
int getWeekyear()
int getCenturyOfEra()
int getYearOfEra()
int getYearOfCentury()
int getMonthOfYear()
int getWeekOfWeekyear()
int getDayOfYear()
int getDayOfMonth()
int getDayOfWeek()
int getHourOfDay()
int getMinuteOfHour()
int getSecondOfMinute()
int getMillisOfSecond()
int getTimeZoneOffsetHours()
String getTimeZoneId()
DateTime toUtcTimeZone()
DateTime toTimeZone(String timeZoneId)
timeZoneId
- the time zone identifierIllegalArgumentException
- if the time zone identifier is null or is invalidboolean isBefore(DateTime other)
other
- the date-time to compare with#compareTo(DateTime)
,
isSameAs(DateTime)
,
isAfter(DateTime)
boolean isAfter(DateTime other)
other
- the date-time to compare with#compareTo(DateTime)
,
isBefore(DateTime)
,
isSameAs(DateTime)
boolean isSameAs(DateTime other)
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.other
- the date-time to compare with#compareTo(DateTime)
,
isBefore(DateTime)
,
isAfter(DateTime)
DateTime minus(long timeAmount, TimeUnit unit)
timeAmount
- the amount of time to subtractunit
- the units of the amount of time; may not be nullDateTime minusDays(int days)
days
- the number of days to subtractDateTime minusHours(int hours)
hours
- the number of hours to subtractDateTime minusMillis(int milliseconds)
milliseconds
- the number of milliseconds to subtractDateTime minusMinutes(int minutes)
minutes
- the number of minutes to subtractDateTime minusMonths(int months)
months
- the number of months to subtractDateTime minusSeconds(int seconds)
seconds
- the number of seconds to subtractDateTime minusWeeks(int weeks)
weeks
- the number of weeks to subtractDateTime minusYears(int years)
years
- the number of years to subtractDateTime plus(long timeAmount, TimeUnit unit)
timeAmount
- the amount of time to addunit
- the units of the amount of time; may not be nullDateTime plusDays(int days)
days
- the number of days to addDateTime plusHours(int hours)
hours
- the number of hours to addDateTime plusMillis(int milliseconds)
milliseconds
- the number of milliseconds to addDateTime plusMinutes(int minutes)
minutes
- the number of minutes to addDateTime plusMonths(int months)
months
- the number of months to addDateTime plusSeconds(int seconds)
seconds
- the number of seconds to addDateTime plusWeeks(int weeks)
weeks
- the number of weeks to addDateTime plusYears(int years)
years
- the number of years to addCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.