Package com.atlassian.jira.datetime
Class LocalDate
java.lang.Object
com.atlassian.jira.datetime.LocalDate
- All Implemented Interfaces:
Comparable<LocalDate>
Represents a "Local Date" or "Calendar Date" - that is a date (no time) without any associated timezone.
LocalDate is only defined to handle years in the Common Era - it cannot handle dates that are BC.
- Since:
- v4.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
getDay()
getEarlierDate
(LocalDate that) long
Returns the number of days since this LocalDate and the java epoch, whose zero-day is set to 1970-01-01.long
Returns the number of milliseconds since the epoch using a zero offset.getLaterDate
(LocalDate that) int
getMonth()
int
getYear()
int
hashCode()
minusDays
(int days) minusMonths
(int months) minusYears
(int years) plusDays
(int days) plusMonths
(int months) plusYears
(int years) toDate()
Convert theLocalDate
into aDate
.toString()
-
Constructor Details
-
LocalDate
public LocalDate(long daysSinceEpoch) Creates a new LocalDate based on the number of days that have passed relative to the java epoch: 1970-01-01.- Parameters:
daysSinceEpoch
- days since the java epoch. see @ java.time.LocalDate.ofEpochDay- Since:
- 8.0
-
LocalDate
public LocalDate(int year, int month, int day)
-
-
Method Details
-
getYear
public int getYear() -
getMonth
public int getMonth() -
getDay
public int getDay() -
getEpochDays
public long getEpochDays()Returns the number of days since this LocalDate and the java epoch, whose zero-day is set to 1970-01-01.- Returns:
- # of days between this LocalDate and the java epoch.
-
getEpochMilliseconds
public long getEpochMilliseconds()Returns the number of milliseconds since the epoch using a zero offset.- Returns:
- The number of milliseconds since the epoch. Can be a negative number.
- Since:
- 11.0
-
toDate
Convert theLocalDate
into aDate
.- Returns:
- The
LocalDate
converted into aDate
. - Since:
- 11.0
-
getEarlierDate
-
getLaterDate
-
plusDays
-
minusDays
-
plusMonths
-
minusMonths
-
plusYears
-
minusYears
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<LocalDate>
-