php[architect] magazine has shared a column from their July 2017 issue, "Education Station" by Matthew Setter, looking at the use of Period for date and time handling.
For the longest time, I’ve enjoyed using PHP’s DateTime library. I’ve always found it to be relatively straightforward in creating DateTime objects for use with various applications I’ve written.
However, one thing that isn’t very simple, nor intuitive, is the ability to create time ranges—especially ones requiring some degree of sophistication, such as fiscal quarters, for financial reporting requirements. [...] It’s for [code reuse] reasons that I’m going to spend the [end] of the column introducing Period, a Time range API for PHP, maintained by The League of Extraordinary Packages.
He starts off by showing how to do things "the hard way" with the built-in PHP DateTime handling and how difficult it can be to work with ranges. In his example he tries to get the dates for a "quarter", a portion of a year usually used for business reporting purposes. He works through some of the issues he faced during the date calculations and things lie leap years and odd date ranges. He then introduces Period as a way to help solve some of these problems. He lists out the main goals of the project, installing the package and using it to get the same "quarter" dates as his attempt before.