public final class Dates
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Dates.Quarter
The quarters of the year
|
Modifier and Type | Method and Description |
---|---|
static java.time.LocalDate |
getFirstDayOfCurrentYear() |
static java.time.LocalDate |
getFirstDayOfLastMonth() |
static java.time.LocalDate |
getFirstDayOfMonth(int toAdd) |
static java.time.LocalDate |
getFirstDayOfQuarter(Dates.Quarter quarter)
Returns the first day of the the given quarter, assuming quarters begin
in january, april, july and october.
|
static java.time.LocalDate |
getFirstDayOfYear(int year) |
static java.time.LocalDate |
getLastDayOfCurrentYear() |
static java.time.LocalDate |
getLastDayOfLastMonth() |
static java.time.LocalDate |
getLastDayOfMonth(int toAdd) |
static java.time.LocalDate |
getLastDayOfQuarter(Dates.Quarter quarter)
Returns the last day of the the given quarter, assuming quarters begin
in january, april, july and october.
|
static java.time.LocalDate |
getLastDayOfYear(int year) |
static java.time.LocalDate |
getYesterday() |
static long |
numberOfDaysInRange(java.time.LocalDate from,
java.time.LocalDate to)
Calculates the number of days between the two dates, note that this is inclusive so
the number of days between two instances of the same date is 1.
|
public static java.time.LocalDate getYesterday()
public static java.time.LocalDate getFirstDayOfLastMonth()
public static java.time.LocalDate getLastDayOfLastMonth()
public static java.time.LocalDate getFirstDayOfMonth(int toAdd)
toAdd
- the number of months to add to the current monthtoAdd
from the current monthpublic static java.time.LocalDate getLastDayOfMonth(int toAdd)
toAdd
- the number of months to add to the current monthtoAdd
from the current monthpublic static java.time.LocalDate getFirstDayOfCurrentYear()
public static java.time.LocalDate getFirstDayOfYear(int year)
year
- the yearpublic static java.time.LocalDate getLastDayOfCurrentYear()
public static java.time.LocalDate getLastDayOfYear(int year)
year
- the yearpublic static java.time.LocalDate getFirstDayOfQuarter(Dates.Quarter quarter)
quarter
- the Quarterpublic static java.time.LocalDate getLastDayOfQuarter(Dates.Quarter quarter)
quarter
- the Quarterpublic static long numberOfDaysInRange(java.time.LocalDate from, java.time.LocalDate to)
from
- the from date, inclusiveto
- the to date, inclusive