View source code
							
							
						
								Display the source code in std/datetime/interval.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Struct std.datetime.interval.Interval
Represents an interval of time.
						
				struct Interval(TP)
				;
						
					
				An Interval has a starting point and an end point. The interval of time
    is therefore the time starting at the starting point up to, but not
    including, the end point. e.g.
| [January 5th, 2010 - March 10th, 2010) | 
| [05:00:30 - 12:00:00) | 
| [1982-01-04T08:59:00 - 2010-07-04T12:00:00) | 
    A range can be obtained from an Interval, allowing iteration over
    that interval, with the exact time points which are iterated over depending
    on the function which generates the range.
Constructors
| Name | Description | 
|---|---|
| this(begin, end) | |
| this(begin, duration) | 
Properties
| Name | Type | Description | 
|---|---|---|
| begin[get] | TP | The starting point of the interval. It is included in the interval. | 
| begin[set] | TP | The starting point of the interval. It is included in the interval. | 
| empty[get] | bool | Whether the interval's length is 0, that is, whether begin == end. | 
| end[get] | TP | The end point of the interval. It is excluded from the interval. | 
| end[set] | TP | The end point of the interval. It is excluded from the interval. | 
| length[get] | auto | Returns the duration between beginandend. | 
Methods
| Name | Description | 
|---|---|
| bwdRange(func, popFirst) | Returns a range which iterates backwards over the interval, starting
        at end, using func to generate each successive time
        point. | 
| contains(timePoint) | Whether the given time point is within this interval. | 
| contains(interval) | Whether the given interval is completely within this interval. | 
| contains(interval) | Whether the given interval is completely within this interval. | 
| contains(interval) | Whether the given interval is completely within this interval. | 
| expand(duration, dir) | Expands the interval forwards and/or backwards in time. Effectively,
        it does begin -= durationand/orend += duration. Whether
        it expands forwards and/or backwards in time is determined by
        dir. | 
| expand(years, months, allowOverflow, dir) | Expands the interval forwards and/or backwards in time. Effectively,
            it subtracts the given number of months/years from beginand
            adds them toend. Whether it expands forwards and/or backwards
            in time is determined by dir. | 
| fwdRange(func, popFirst) | Returns a range which iterates forward over the interval, starting
        at begin, using func to generate each successive time
        point. | 
| intersection(interval) | Returns the intersection of two intervals | 
| intersection(interval) | Returns the intersection of two intervals | 
| intersection(interval) | Returns the intersection of two intervals | 
| intersects(interval) | Whether the given interval overlaps this interval. | 
| intersects(interval) | Whether the given interval overlaps this interval. | 
| intersects(interval) | Whether the given interval overlaps this interval. | 
| isAdjacent(interval) | Whether the given interval is adjacent to this interval. | 
| isAdjacent(interval) | Whether the given interval is adjacent to this interval. | 
| isAdjacent(interval) | Whether the given interval is adjacent to this interval. | 
| isAfter(timePoint) | Whether this interval is after the given time point. | 
| isAfter(interval) | Whether this interval is after the given interval and does not intersect it. | 
| isAfter(interval) | Whether this interval is after the given interval and does not intersect it. | 
| isAfter(interval) | Whether this interval is after the given interval and does not intersect it. | 
| isBefore(timePoint) | Whether this interval is before the given time point. | 
| isBefore(interval) | Whether this interval is before the given interval and does not intersect with it. | 
| isBefore(interval) | Whether this interval is before the given interval and does not intersect with it. | 
| isBefore(interval) | Whether this interval is before the given interval and does not intersect with it. | 
| merge(interval) | Returns the union of two intervals | 
| merge(interval) | Returns the union of two intervals | 
| merge(interval) | Returns the union of two intervals | 
| opAssign(rhs) | |
| shift(duration) | Shifts the interval forward or backwards in time by the given duration
        (a positive duration shifts the interval forward; a negative duration
        shifts it backward). Effectively, it does begin += durationandend += duration. | 
| shift(years, months, allowOverflow) | Shifts the interval forward or backwards in time by the given number
            of years and/or months (a positive number of years and months shifts
            the interval forward; a negative number shifts it backward).
            It adds the years the given years and months to both begin and end.
            It effectively calls add!"years"()and thenadd!"months"()on begin and end with the given number of years and months. | 
| span(interval) | Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. | 
| span(interval) | Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. | 
| span(interval) | Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. | 
| toString() | Converts this interval to a string. | 
Authors
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.