refactoring / time
Facilitates working with intervals
Installs: 154
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/refactoring/time
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.3.*
This package is not auto-updated.
Last update: 2025-10-07 09:00:57 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"; }