public interface Calendar
DBDateTime.toDateString
.
This can be slower than methods written explicitly for DBDateTimes.
If performance is an issue, consider overriding these
methods with other behavior.Modifier and Type | Method and Description |
---|---|
default String |
currentDay()
Gets the current date.
|
default DayOfWeek |
dayOfWeek()
Gets the day of the week for the current day.
|
DayOfWeek |
dayOfWeek(DBDateTime time)
Gets the day of the week for a time.
|
DayOfWeek |
dayOfWeek(String date)
Gets the day of the week for a time.
|
String[] |
daysInRange(DBDateTime start,
DBDateTime end)
Gets the days in a given range.
|
String[] |
daysInRange(String start,
String end)
Gets the days in a given range.
|
double |
diffDay(DBDateTime start,
DBDateTime end)
Returns the amount of time in days between
start and end . |
long |
diffNanos(DBDateTime start,
DBDateTime end)
Returns the amount of time in nanoseconds between
start and end . |
double |
diffYear(DBDateTime start,
DBDateTime end)
Returns the number of years between
start and end . |
String |
name()
Gets the name of the calendar.
|
default String |
nextDay()
Gets tomorrow's date.
|
String |
nextDay(DBDateTime time)
Gets the next date.
|
String |
nextDay(DBDateTime time,
int days)
Gets the date
days after the input time . |
default String |
nextDay(int days)
Gets the date
days after the current day. |
String |
nextDay(String date)
Gets the next date.
|
String |
nextDay(String date,
int days)
Gets the date
days after the input date . |
int |
numberOfDays(DBDateTime start,
DBDateTime end)
Gets the number of days in a given range, end date exclusive.
|
int |
numberOfDays(DBDateTime start,
DBDateTime end,
boolean endInclusive)
Gets the number of days in a given range.
|
int |
numberOfDays(String start,
String end)
Gets the number of days in a given range, end date exclusive.
|
int |
numberOfDays(String start,
String end,
boolean endInclusive)
Gets the number of days in a given range.
|
default String |
previousDay()
Gets yesterday's date.
|
String |
previousDay(DBDateTime time)
Gets the previous date.
|
String |
previousDay(DBDateTime time,
int days)
Gets the date the specified number of days prior to the input date.
|
default String |
previousDay(int days)
Gets the date the specified number of days prior to the current day.
|
String |
previousDay(String date)
Gets the previous date.
|
String |
previousDay(String date,
int days)
Gets the date the specified number of days prior to the input date.
|
DBTimeZone |
timeZone()
Gets the timezone of the calendar.
|
String name()
default String currentDay()
default String previousDay()
default String previousDay(int days)
days
- number of days;days
before the current dayString previousDay(DBDateTime time)
time
- time; if null, return nulltime
String previousDay(DBDateTime time, int days)
time
- time; if null, return nulldays
- number of days;days
before date
String previousDay(String date)
date
- date; if null, return nulldate
String previousDay(String date, int days)
date
- date; if null, return nulldays
- number of days;days
before date
default String nextDay()
default String nextDay(int days)
days
after the current day.days
- number of days;String nextDay(DBDateTime time)
time
- time; if null, return nulltime
String nextDay(DBDateTime time, int days)
days
after the input time
.time
- time; if null, return nulldays
- number of days;time
String nextDay(String date)
date
- date; if null, return nulltime
String nextDay(String date, int days)
days
after the input date
.date
- time; if null, return nulldays
- number of days;time
String[] daysInRange(DBDateTime start, DBDateTime end)
start
- start of a time range; if null, return empty arrayend
- end of a time range; if null, return empty arraystart
and end
String[] daysInRange(String start, String end)
start
- start of a time range; if null, return empty arrayend
- end of a time range; if null, return empty arraystart
and end
int numberOfDays(DBDateTime start, DBDateTime end)
start
- start of a time range; if null, return NULL_INT
end
- end of a time range; if null, return NULL_INT
start
and end
, inclusive and exclusive respectively.int numberOfDays(DBDateTime start, DBDateTime end, boolean endInclusive)
start
- start of a time range; if null, return NULL_INT
end
- end of a time range; if null, return NULL_INT
endInclusive
- whether to treat the end
inclusive or exclusivelystart
and end
, inclusive and endInclusive
respectively.int numberOfDays(String start, String end)
start
- start of a time range; if null, return NULL_INT
end
- end of a time range; if null, return NULL_INT
start
and end
, inclusive and exclusive respectively.int numberOfDays(String start, String end, boolean endInclusive)
start
- start of a time range; if null, return NULL_INT
end
- end of a time range; if null, return NULL_INT
endInclusive
- whether to treat the end
inclusive or exclusivelystart
and end
, inclusive and endInclusive
respectively.long diffNanos(DBDateTime start, DBDateTime end)
start
and end
.start
- start time; if null, return NULL_LONGend
- end time; if null, return NULL_LONGstart
and end
double diffDay(DBDateTime start, DBDateTime end)
start
and end
.start
- start time; if null, return NULL_LONGend
- end time; if null, return NULL_LONGstart
and end
double diffYear(DBDateTime start, DBDateTime end)
start
and end
.start
- start; if null, return nullend
- end; if null, return nullstart
and end
default DayOfWeek dayOfWeek()
DayOfWeek dayOfWeek(DBDateTime time)
time
- time; if null, return nulltime
DayOfWeek dayOfWeek(String date)
date
- date; if null, return nulldate
DBTimeZone timeZone()