重构时间

便于处理时间间隔

0.2.0 2015-03-07 12:19 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:59:39 UTC


README

重构.ro库的时间组件。提供方便的方法来处理日期,特别是时间间隔。

示例

$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";
}