refactoring / time
Facilitates working with intervals
0.2.0
2015-03-07 12:19 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.3.*
This package is not auto-updated.
Last update: 2025-02-25 06:05:45 UTC
README
Time Component of the refactoring.ro library. Provides conenient methods to work with Dates, especially with intervals.
Example
$lastMonth = new LastMonth();
echo "First of last month was ",$lastMonth->getStart()->format("Y-m-d"),"\n"; $today = new \DateTime(); if (!($lastMonth->contains($today))) { echo "Today is not contained in last month \n"; } $thisMonth = new ThisMonth(); if ($thisMonth->contains($today)) { echo "This month contains today\n"; } $thisYear = new ThisYear(); if ($thisYear->overlaps($lastMonth)) { echo "This year overlaps with last month \n"; }