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.

std.datetime.interval.Interval.this - multiple declarations

Function Interval.this

this(U) (
  scope const TP begin,
  scope const U end
) pure
if (is(immutable(TP) == immutable(U)));

Parameters

NameDescription
begin The time point which begins the interval.
end The time point which ends (but is not included in) the interval.

Throws

DateTimeException if end is before begin.

Example

Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1));

Function Interval.this

this(D) (
  scope const TP begin,
  scope const D duration
) pure
if (__traits(compiles, begin + duration));

Parameters

NameDescription
begin The time point which begins the interval.
duration The duration from the starting point to the end point.

Throws

DateTimeException if the resulting end is before begin.

Example

assert(Interval!Date(Date(1996, 1, 2), dur!"days"(3)) ==
       Interval!Date(Date(1996, 1, 2), Date(1996, 1, 5)));

Authors

Jonathan M Davis

License

Boost License 1.0.