Download the PHP package wwtg99/date_period without Composer
On this page you can find all versions of the php package wwtg99/date_period. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package date_period
Date Period
Generate a series of date period, usually for statistics. 基于日、周、月、年等的时间段切分。
Installation
or add
to composer.json
Test
Unit test file in tests. Tested in PHP 7.1.
Usage
Methods
- DatePeriod::getPeriodArray($datePeriod, $start, $end, $dateFormat)
- DatePeriod::getPeriodGenerator($datePeriod, $start, $end, $dateFormat)
Params
- $datePeriod: period to separate, day, week, month, year ...
- $start: start time string
- $end: end time string
- $dateFormat: date format(default) or datetime format
Examples
Generate day array between start day(included) and end day(excluded)
Output:
Generate month array between start day(included) and end day(excluded)
Output:
Use generator instead of array (usually for very long period)
Generator support PHP 7.0+.
Output:
Supported period
- Second: every second from start to end
- Minute: every minute from start to end
- Hour: every hour from start to end
- Day: every day from start to end
- Week: every week from start to end
- Month: every month from start to end
- Season: every season from start to end
- Year: every year from start to end
- None: same as DateInterval
All versions of date_period with dependencies
PHP Build Version
Package Version
The package wwtg99/date_period contains the following files
Loading the files please wait ....