Package com.storedobject.core
Class DatePeriod
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDatePeriod(Date from, Date to) Create fromDateobjects.DatePeriod(Calendar from, Calendar to) Create fromCalendarobjects.DatePeriod(Date from, Date to) Create fromDateobjects. -
Method Summary
Modifier and TypeMethodDescriptionprotected DateClones the given date.static DatePeriodcreate()Create a period for today (from and to will be today).static DatePeriodCreate a period for a single date (from and to will be the same).static DatePeriodCreate a period from two dates.Get aTimePeriodfor this date period.static DatePeriodCreate a period from the start of the current month till today.static DatePeriodCreate a period from the start of the current month till yesterday.protected booleanChecks if two dates are the same.static DatePeriodCreate a period for the current month.static DatePeriodthisYear()Create a period for the current year.static DatePeriodtillToday(int fromDays) Create a period ending today and starting a specific number of days ago.static DatePeriodtillYesterday(int fromDays) Create a period ending yesterday and starting a specific number of days ago.protected StringConverts the date to a string.static DatePeriodCreate a period from the start of the current year till today.static DatePeriodCreate a period from the start of the current year till yesterday.Methods inherited from class com.storedobject.core.AbstractPeriod
getCalendarFrom, getCalendarTo, getDBCondition, getDBCondition, getDBTimeCondition, getDBTimeCondition, getMonth, getMonthFrom, getMonthTo, getPeriodInDays, getPeriodInMonths, getYear, getYearFrom, getYearTo, inside, inside, overlaps, toDBString, toShortString, toString, value
-
Constructor Details
-
DatePeriod
-
DatePeriod
-
DatePeriod
-
-
Method Details
-
create
Create a period from two dates. The dates will be swapped if from date is after the to date.- Parameters:
dateFrom- The starting point of the period.dateTo- The ending point of the period.- Returns:
- The date period created.
-
create
Create a period for a single date (from and to will be the same).- Parameters:
date- The date.- Returns:
- The date period created.
-
create
Create a period for today (from and to will be today).- Returns:
- The date period created.
-
clone
-
same
-
toString
-
getTimePeriod
-
thisMonth
Create a period for the current month.- Returns:
- The date period for the current month.
-
monthTillToday
Create a period from the start of the current month till today.- Returns:
- The date period.
-
monthTillYesterday
Create a period from the start of the current month till yesterday.- Returns:
- The date period.
-
thisYear
Create a period for the current year.- Returns:
- The date period for the current year.
-
yearTillToday
Create a period from the start of the current year till today.- Returns:
- The date period.
-
yearTillYesterday
Create a period from the start of the current year till yesterday.- Returns:
- The date period.
-
tillToday
Create a period ending today and starting a specific number of days ago.- Parameters:
fromDays- Number of days ago to start.- Returns:
- The date period.
-
tillYesterday
Create a period ending yesterday and starting a specific number of days ago.- Parameters:
fromDays- Number of days ago to start.- Returns:
- The date period.
-