drlenux/date-helper
Composer 安装命令:
composer require drlenux/date-helper
包简介
Date helper
README 文档
README
Author: DrLenux
License: MIT
Allow method DateChange:
interface DateChange { function addDay(int $count = 1): self; function addMonth(int $count = 1): self; function addYear(int $count = 1): self; function addHour(int $count = 1): self; function addMinute(int $count = 1): self; function addSeconds(int $count = 1): self; function subDay(int $count = 1): self; function subMonth(int $count = 1): self; function subYear(int $count = 1): self; function subHour(int $count = 1): self; function subMinute(int $count = 1): self; function subSeconds(int $count = 1): self; function diff(DateChange $date): DateInterval|bool; }
Example DateChange:
<?php use DrLenux\DataHelper\DateChange; $date = (new DateChange('2012-12-12')) ->addYear() ->addMonth(2) ->subDay();
Allow method DateFill:
interface DateFill { function to(string $to) function from(string $from) function inclusiveStart(bool $status) function inclusiveEnd(bool $status) function interval(string $interval) function format(string $format) function timezone(\DateTimeZone $timezone = null) function fill() function getErrors() }
Example DateFill:
<?php use DrLenux\DataHelper\DateFill; $fillArray = (new DateFill()) ->from('2011-01-01') ->to('2011-01-02') ->interval(DateFill::INTERVAL_HOUR) ->fill(); /* return [ '2011-01-01 01:00:00', ... '2011-01-01 23:00:00' ]; */
Example Interval:
<?php use DrLenux\DataHelper\DateFill; (new DateFill()) ->from('2011-10-09 23:59:59') ->to('2011-10-09 23:50:00') ->interval('PT2M') // every 2 minute ->format('H:i:s') ->fill(); /* return [ '23:57:59', '23:55:59', '23:53:59', '23:51:59' ]; */
Example Diff:
<?php use DrLenux\DataHelper\DateChange; $date1 = new DateChange('01-01-2018'); $date2 = new DateChange('01-01-2017'); $diff = $date1->diff($date2); echo $diff->days; /* return 365; */
drlenux/date-helper 适用场景与选型建议
drlenux/date-helper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 05 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 drlenux/date-helper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 drlenux/date-helper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-02