public class PeriodFactory extends Object
Constructor and Description |
---|
PeriodFactory() |
Modifier and Type | Method and Description |
---|---|
static Period |
createDayPeriod(long timestamp)
Creates a new Period instance that matches exactly the day that includes the specified time stamp.
|
static Period |
createDayPeriod(String date)
Creates a new Period instance that matches exactly the day that includes the specified date.
|
static Period |
createHourPeriod(long timestamp)
Creates a new Period instance that matches exactly the hour that includes the specified time stamp.
|
static Period |
createHourPeriod(String date)
Creates a new Period instance that matches exactly the hour that includes the specified date.
|
static Period |
createMaximumPeriod()
Creates a new Period instance that starts at the minimum value allowed by Date and ends at the maximum value
allowed by Date.
|
static Period |
createMonthPeriod(long timestamp)
Creates a new Period instance that matches exactly the month that includes the specified time stamp.
|
static Period |
createMonthPeriod(String date)
Creates a new Period instance that matches exactly the month that includes the specified date.
|
static Period |
createPeriod(long start,
long end) |
static Period |
createPeriod(String start,
String end)
Creates a new custom period.
|
static Period |
createSinceDaysPeriod(int numberOfDays)
Creates a new Period instance that matches all the instants between N days before the instantiation and the
instantiation.
|
static Period |
createSinceHoursPeriod(int numberOfHours)
Creates a new Period instance that matches all the instants between N hours before the instantiation and the
instantiation.
|
static Period |
createSinceMonthsPeriod(int numberOfMonths)
Creates a new Period instance that matches all the instants between N months before the instantiation and the
instantiation.
|
static Period |
createSinceWeeksPeriod(int numberOfWeeks)
Creates a new Period instance that matches all the instants between N weeks before the instantiation and the
instantiation.
|
static Period |
createSinceYearsPeriod(int numberOfYears)
Creates a new Period instance that matches all the instants between N years before the instantiation and the
instantiation.
|
static Period |
createWeekPeriod(long timestamp)
Creates a new Period instance that matches exactly the week that includes the specified time stamp.
|
static Period |
createWeekPeriod(String date)
Creates a new Period instance that matches exactly the week that includes the specified date.
|
static Period |
createYearPeriod(long timestamp)
Creates a new Period instance that matches exactly the year that includes the specified time stamp.
|
static Period |
createYearPeriod(String date)
Creates a new Period instance that matches exactly the year that includes the specified date.
|
static Period |
getALL_TIME()
Helper method for accessing
ALL_TIME static field in velocity |
static Period |
getCurrentDay() |
static Period |
getCurrentMonth() |
static Period |
getCurrentWeek() |
static Period |
getCurrentYear() |
public static final Period ALL_TIME
public static Period createPeriod(long start, long end)
Period(long, long)
public static Period createPeriod(String start, String end)
start
- The start dateend
- The end dateSimpleDateFormat
public static Period createDayPeriod(long timestamp)
timestamp
- The milliseconds from 1970-01-01T00:00:00Zpublic static Period createDayPeriod(String date)
date
- The string representation of a date uniquely identifying a day. Use the "yyyyMMdd" format.SimpleDateFormat
public static Period createHourPeriod(long timestamp)
timestamp
- The milliseconds from 1970-01-01T00:00:00Zpublic static Period createHourPeriod(String date)
date
- The string representation of a date uniquely identifying a day. Use the "yyyyMMdd" format.SimpleDateFormat
public static Period createSinceHoursPeriod(int numberOfHours)
numberOfHours
- number of hours to substract from current datepublic static Period createSinceDaysPeriod(int numberOfDays)
numberOfDays
- number of days to substract from current datepublic static Period createSinceWeeksPeriod(int numberOfWeeks)
numberOfWeeks
- number of weeks to substract from current datepublic static Period createSinceMonthsPeriod(int numberOfMonths)
numberOfMonths
- number of months to substract from current datepublic static Period createSinceYearsPeriod(int numberOfYears)
numberOfYears
- number of years to substract from current datepublic static Period getCurrentDay()
public static Period createWeekPeriod(long timestamp)
timestamp
- The milliseconds from 1970-01-01T00:00:00Zpublic static Period createWeekPeriod(String date)
date
- The string representation of a date uniquely identifying a week. Use the "yyyyMMdd" format.SimpleDateFormat
public static Period getCurrentWeek()
public static Period createMonthPeriod(long timestamp)
timestamp
- The milliseconds from 1970-01-01T00:00:00Zpublic static Period createMonthPeriod(String date)
date
- The string representation of a date uniquely identifying a month. Use the "yyyyMMdd" format.SimpleDateFormat
public static Period getCurrentMonth()
public static Period createYearPeriod(long timestamp)
timestamp
- The milliseconds from 1970-01-01T00:00:00Zpublic static Period createYearPeriod(String date)
date
- The string representation of a date uniquely identifying a year. Use the "yyyyMMdd" format.SimpleDateFormat
public static Period createMaximumPeriod()
public static Period getCurrentYear()
Copyright © 2004–2022 XWiki. All rights reserved.