avris/timeiterator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

avris/timeiterator

最新稳定版本:v1.0.0

Composer 安装命令:

composer require avris/timeiterator

包简介

Simple helper to iterate over time

README 文档

README

Simple helper to iterate over time:

foreach (TimeIterator::create('today', '+1 day', 'last day of this month') as $day) {
    createEventForDate($day);
    echo 'Event created for date: ' . $day->format('Y-m-d') . PHP_EOL;
}

will output a list of dates from today until the end of the month. Simple, isn't it?

You can also fetch an array of DateTime objects using getArray():

$ti = new TimeIterator('now', '+1 minute', 'tomorrow');
doSomething($ti->getArray());

Or if you just need an array of strings, you can just use format($format):

$ti = new TimeIterator('15:00', '-5 minutes', '14:30');
return $ti->format('H:i');

will return:

[
    '15:00',
    '14:55',
    '14:50',
    '14:45',
    '14:40',
    '14:35',
    '14:30',        
]

Author

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: CC-BY
  • 更新时间: 2015-11-04