public abstract class DateTimePeriod extends Object
"DateCol" >= period.getStart() AND "DateCol" < period.getEnd() .
NOTE: This cannot be used with a BETWEEN statement since the end date should
not actually be included. This is more precise since databases may have
different levels of precision such as no milliseconds, or perhaps nano
precision. Also, this representation makes the internal calculations much
easier since the end date would always be start.plusMonths(1).| Modifier | Constructor and Description |
|---|---|
protected |
DateTimePeriod(org.joda.time.DateTime start,
org.joda.time.DateTime end,
DateTimeDuration duration,
String keyPattern,
String longNamePattern,
String shortNamePattern,
String indexNamePattern) |
| Modifier and Type | Method and Description |
|---|---|
static DateTimePeriod |
create(DateTimeDuration duration,
org.joda.time.DateTime start)
Creates a new period for the specified duration starting from the
provided DateTime.
|
static DateTimePeriod |
createDay(org.joda.time.DateTime start) |
static DateTimePeriod |
createDay(int year,
int month,
int day,
org.joda.time.DateTimeZone zone) |
static DateTimePeriod |
createFiveMinutes(org.joda.time.DateTime start) |
static DateTimePeriod |
createFiveMinutes(int year,
int month,
int day,
int hour,
int minute,
org.joda.time.DateTimeZone zone) |
static DateTimePeriod |
createHour(org.joda.time.DateTime start) |
static DateTimePeriod |
createHour(int year,
int month,
int day,
int hour,
org.joda.time.DateTimeZone zone) |
static List<DateTimePeriod> |
createLastYearMonths(org.joda.time.DateTimeZone zone)
Create a list of DateTimePeriods that represent the last year of
YearMonth periods.
|
static DateTimePeriod |
createMonth(org.joda.time.DateTime start) |
static DateTimePeriod |
createMonth(int year,
int month,
org.joda.time.DateTimeZone zone) |
static DateTimePeriod |
createYear(org.joda.time.DateTime start) |
static DateTimePeriod |
createYear(int year,
org.joda.time.DateTimeZone zone) |
boolean |
equals(Object object)
Compares another DateTimePeriod for equality if the internal start
and end DateTimes equal this period.
|
abstract DateTimeDuration |
getDefaultSubDuration()
Gets the default "Group By" enumeration based on the duration for this
period.
|
DateTimeDuration |
getDuration()
Gets the duration this period represents such as a Month, Year, etc.
|
org.joda.time.DateTime |
getEnd()
Gets the exclusive ending DateTime for this period.
|
String |
getIndexName()
Gets an index name for this period appropriate for display to only identify
the particular row by the smallest possible identifer.
|
String |
getKey()
Gets a key that is unique to this period.
|
String |
getLongName()
Gets a long name for this period appropriate for display as the title
for a report such as "January 2009".
|
abstract DateTimePeriod |
getNext()
Gets the next period based on the duration.
|
abstract DateTimePeriod |
getPrevious()
Gets the previous period based on the duration.
|
String |
getShortName()
Gets a short name for this period appropriate for display within a table
of data to identify a row.
|
org.joda.time.DateTime |
getStart()
Gets the inclusive starting DateTime for this period.
|
int |
hashCode()
Hashcode computed based on the internal start and end DateTime hashCode
values.
|
List<DateTimePeriod> |
toDays()
Converts this period to a list of day periods.
|
List<DateTimePeriod> |
toFiveMinutes()
Converts this period to a list of five minute periods.
|
List<DateTimePeriod> |
toHours()
Converts this period to a list of hour periods.
|
List<DateTimePeriod> |
toMonths()
Converts this period to a list of month periods.
|
List<DateTimePeriod> |
toPeriods(DateTimeDuration duration)
Converts this period to a list of periods for the given duration.
|
List<DateTimePeriod> |
toYears()
Converts this period to a list of year periods.
|
protected DateTimePeriod(org.joda.time.DateTime start,
org.joda.time.DateTime end,
DateTimeDuration duration,
String keyPattern,
String longNamePattern,
String shortNamePattern,
String indexNamePattern)
public org.joda.time.DateTime getStart()
public org.joda.time.DateTime getEnd()
public DateTimeDuration getDuration()
public String getKey()
public String getLongName()
getShortName(),
getIndexName()public String getShortName()
getLongName(),
getIndexName()public String getIndexName()
getLongName(),
getShortName()public abstract DateTimePeriod getNext()
public abstract DateTimePeriod getPrevious()
public abstract DateTimeDuration getDefaultSubDuration()
public List<DateTimePeriod> toPeriods(DateTimeDuration duration)
toFiveMinutes(),
toHours(),
toDays(),
toMonths(),
toYears()public List<DateTimePeriod> toFiveMinutes()
public List<DateTimePeriod> toHours()
public List<DateTimePeriod> toDays()
public List<DateTimePeriod> toMonths()
public List<DateTimePeriod> toYears()
public boolean equals(Object object)
public int hashCode()
public static DateTimePeriod create(DateTimeDuration duration, org.joda.time.DateTime start)
duration - The duration for this period such as Month, Hour, etc.start - The DateTime to start this period frompublic static DateTimePeriod createYear(int year, org.joda.time.DateTimeZone zone)
public static DateTimePeriod createYear(org.joda.time.DateTime start)
public static DateTimePeriod createMonth(int year, int month, org.joda.time.DateTimeZone zone)
public static DateTimePeriod createMonth(org.joda.time.DateTime start)
public static DateTimePeriod createDay(int year, int month, int day, org.joda.time.DateTimeZone zone)
public static DateTimePeriod createDay(org.joda.time.DateTime start)
public static DateTimePeriod createHour(int year, int month, int day, int hour, org.joda.time.DateTimeZone zone)
public static DateTimePeriod createHour(org.joda.time.DateTime start)
public static DateTimePeriod createFiveMinutes(int year, int month, int day, int hour, int minute, org.joda.time.DateTimeZone zone)
public static DateTimePeriod createFiveMinutes(org.joda.time.DateTime start)
public static List<DateTimePeriod> createLastYearMonths(org.joda.time.DateTimeZone zone)
zone - Copyright © 2012-2015 Cloudhopper by Twitter. All Rights Reserved.