This is the documentation for version 4.0 which will be supported until 2022-08-21. Please consider upgrading your code to the latest stable version

Definitions

Concepts

Since version 4.4 all basic boundary types are supported by the library.

  • interval - Period is a PHP implementation of a datetime interval which consists of:
    • two datepoints;
    • the duration between them;
    • a boundary type.
  • datepoint - A position in time expressed as a DateTimeImmutable object. The starting datepoint is always less than or equal to the ending datepoint.

  • duration - The continuous portion of time between two datepoints expressed as a DateInterval object. The duration cannot be negative.

  • boundary type - An included datepoint means that the boundary datepoint itself is included in the interval as well, while an excluded datepoint means that the boundary datepoint is not included in the interval.
    The package supports included and excluded datepoint, thus, the following boundary types are supported:
    • included starting datepoint and excluded ending datepoint: [start, end);
    • included starting datepoint and included ending datepoint : [start, end];
    • excluded starting datepoint and included ending datepoint : (start, end];
    • excluded starting datepoint and excluded ending datepoint : (start, end);

infinite or unbounded intervals are not supported.

Arguments

Since this package relies heavily on DateTimeImmutable and DateInterval objects and because it is sometimes complicated to get your hands on such objects the package comes bundled with:

Since version 4.2 both functions are deprecated and you are encouraged to use the classes instead.