苏可伊 / 截止日期
此包的最新版本(1.0.0)没有提供许可证信息。
1.0.0
2015-12-09 22:19 UTC
Requires
- php: >=5.4.0
- illuminate/support: 4.2.*
This package is not auto-updated.
Last update: 2024-09-14 17:21:33 UTC
README
A Laravel 包,用于管理截止日期。(目前仅适用于 Laravel 4)
安装
在 composer.json 中添加此包名
"require": {
"sukohi/cutoff": "1.*"
}
执行 composer 命令。
composer update
在 app.php 中注册服务提供者
'providers' => [
...Others...,
'Sukohi\Cutoff\CutoffServiceProvider',
]
也别名
'aliases' => [
...Others...,
'Cutoff' => 'Sukohi\Cutoff\Facades\Cutoff',
]
用法
下一个截止日期
$base_dt = new Carbon('2015-2-28');
$cutoff_day = 25;
echo Cutoff::nextDate($base_dt, $cutoff_day)->toDateString(); // 2015-03-25
上一个截止日期
$base_dt = new Carbon('2015-2-28');
$cutoff_day = 25;
echo Cutoff::prevDate($base_dt, $cutoff_day)->toDateString(); // 2015-01-25
范围
$year = 2015;
$month = 2;
$day = 31;
Cutoff::range($year, $month, $day); // start => 2015-02-01, end => 2015-02-28 23:59:59
许可证
此包采用 MIT 许可证授权。
版权所有 2015 苏可伊 Kuhoh