Class representing a date range.
A DateRange is created using two dates and can be used to make
determinations about dates within the range.
r0 = DateRange(Date(stdfmt = '2/12/98'), Date(stdfmt = '3/13/99'))
# see if a date range includes a particular date
if r0.includes(Date(stdfmt = '12/1/98')):
# see if the range overlaps with another data range
if r0.overlap(DateRange(Date(stdfmt = '12/1/98'),
Date(stdfmt = '1/1/2000')
||A date range is a period in time. By default, a date range begins with|
negative infinity and ends with infinity.
||Methods defined here:|
- __cmp__(self, other)
- Compares the start date of two date ranges. If the two date ranges
have the same start date, compares the end date.
- __init__(self, startDate=<util.Date.Date instance at 0x8279c4c>, endDate=<util.Date.Date instance at 0x8279cec>)
- Constructs a date range. By default, the start date is the
bottomless past and the end date is the endless future. This
allows us to define date ranges from a given point to the end of
time, or from the beginning of time to a given point.
- Formats the receiver as a string (two new standard format dates
seperated by a dash.
- alignedWith(self, other)
- Returns true if the records are "aligned" - that is, if the start
date of one matches the end date of the other.
- Returns the end date.
- Returns the start date.
- includes(self, date)
- Returns true if the date range includes the given date. In keeping
with the spirit of date ranges, inclusion is defined as being
greater than or equal to the start date but less than the end date.
- overlap(self, other)
- Returns true if the receiver date range overlaps with the /other/ date
- setEnd(self, end)
- Resets the end Date.
- setStart(self, start)
- Resets the start Date.
- union(self, other)
- Returns a date range that is the union of the periods defined by
self and other, or None if the two periods do not overlap.