theoaks/relative-datetime-format-builder
最新稳定版本:v1.0.3
Composer 安装命令:
composer require theoaks/relative-datetime-format-builder
包简介
Object Oriented approach to building the different relative date/time formats that the strtotime(), DateTime and date_create() parser understands.
README 文档
README
Object-Oriented approach to building the different relative date/time formats that the strtotime(), DateTime and date_create() parser understands. Check The PHP Documentation for details
How to install
Install using composer
composer require theoaks/relative-datetime-format-builder
How to use
use Oaks\RelativeDatetimeFormatBuilder\RelativeDateTimeFormatBuilder; $first_day_of_january = RelativeDateTimeFormatBuilder::firstDayOf( MonthName::January ); echo $first_day_of_january; $date = $first_day_of_january->toDateTime(); echo $date->format("y-M-d"); /// first day of January this year /// YYYY-01-01 $three_days_from_now = (new RelativeDateTimeFormatBuilder())->addDays(3); echo $three_days_from_now; $date = $three_days_from_now->toDateTime(); $date_immutable = $three_days_from_now->toDateTimeImmutable(); /// +3 day // First day of march 2025 at 11am $format = (new RelativeDateTimeFormatBuilder()) ->firstDay() ->ofMarch() ->year(2025) ->at(hour: 11); echo $format; // first day of March 2025 11:00:00
统计信息
- 总下载量: 1.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-02-03