phellow / date
1.0.1
2014-12-22 21:25 UTC
Requires (Dev)
- phpunit/phpunit: 4.4.*
This package is auto-updated.
Last update: 2024-09-08 22:38:48 UTC
README
这个小型库将帮助您处理日期/时间特定对象。
通过 Composer 安装
将以下依赖项添加到您的项目 composer.json 文件中
{ "require": { "phellow/date": "1.*" } }
用法
使用 DateFactory 创建所有对象。您可以将工厂添加到依赖注入容器中。
$factory = new \Phellow\Date\DateFactory(); // create a DateTime object $dt = $factory->createDateTime(); $dt = $factory->createDateTime('now'); $dt = $factory->createDateTime('2014-12-8'); $dt = $factory->createDateTime(time()); $dt = $factory->createDateTime($dt); // create a Month object $month = $factory->createMonth(); $month = $factory->createMonth('now'); $month = $factory->createMonth('2014-12-8'); $month = $factory->createMonth(time()); $month = $factory->createMonth($dt);
要查看所有可能性,您可以在 tests/ 目录下的单元测试中查看。
许可证
MIT 许可证。