public final class DateWithoutTime extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
static DateWithoutTime |
fromDaysSinceEpoch(int daysSinceEpoch)
Builds a new instance from a number of days since January 1st, 1970 GMT.
|
static DateWithoutTime |
fromMillisSinceEpoch(long millisSinceEpoch)
Builds a new instance from a number of milliseconds since January 1st, 1970 GMT.
|
static DateWithoutTime |
fromYearMonthDay(int year,
int month,
int dayOfMonth)
Builds a new instance from a year/month/day specification.
|
int |
getDay()
Returns the day in the month.
|
int |
getDaysSinceEpoch()
Returns the number of days since January 1st, 1970 GMT.
|
long |
getMillisSinceEpoch()
Returns the number of milliseconds since January 1st, 1970 GMT.
|
int |
getMonth()
Returns the month.
|
int |
getYear()
Returns the year.
|
int |
hashCode() |
DateWithoutTime |
plusDays(int days)
Builds a new instance by adding a number of days.
|
DateWithoutTime |
plusMonths(int months)
Builds a new instance by adding a number of months.
|
DateWithoutTime |
plusYears(int years)
Builds a new instance by adding a number of years.
|
String |
toString() |
public static DateWithoutTime fromDaysSinceEpoch(int daysSinceEpoch)
daysSinceEpoch
- the number of days.public static DateWithoutTime fromMillisSinceEpoch(long millisSinceEpoch) throws IllegalArgumentException
millisSinceEpoch
- the number of milliseconds. Note that if it does not correspond to a whole number of days,
it will be rounded towards 0.IllegalArgumentException
- if the date is not in the range [-5877641-06-23; 5881580-07-11].public static DateWithoutTime fromYearMonthDay(int year, int month, int dayOfMonth)
IllegalArgumentException
.year
- the year in ISO format (see this class's Javadoc
).month
- the month. It is 1-based (e.g. 1 for January).dayOfMonth
- the day of the month.IllegalArgumentException
- if the corresponding date does not exist in the ISO8601
calendar.public int getDaysSinceEpoch()
public long getMillisSinceEpoch()
public int getYear()
public int getMonth()
public int getDay()
public DateWithoutTime plusYears(int years)
years
- the number of years (can be negative).IllegalArgumentException
- if the new date is not in the range [-5877641-06-23; 5881580-07-11].public DateWithoutTime plusMonths(int months)
months
- the number of months (can be negative).IllegalArgumentException
- if the new date is not in the range [-5877641-06-23; 5881580-07-11].public DateWithoutTime plusDays(int days)
days
- the number of days (can be negative).IllegalArgumentException
- if the new date is not in the range [-5877641-06-23; 5881580-07-11].Copyright © 2012–2015. All rights reserved.