PHPackages                             rundiz/date-interval - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rundiz/date-interval

Abandoned → [dragonmantank/cron-expression](/?search=dragonmantank%2Fcron-expression)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

rundiz/date-interval
====================

Set the begins date, interval get get exactly start date in range.

1.0.4(4y ago)08MITPHPPHP &gt;=5.4.0

Since Apr 21Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/Rundiz/date-interval)[ Packagist](https://packagist.org/packages/rundiz/date-interval)[ RSS](/packages/rundiz-date-interval/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

DateInterval Component
======================

[](#dateinterval-component)

**No more update!** Use [Cron expression](https://github.com/dragonmantank/cron-expression) instead.

Set the begins date, interval get get exactly start date in range.

[![Latest Stable Version](https://camo.githubusercontent.com/4f919f14cf9764d476039e7e5fc72b1cac46adafd215e5044addbb56ef65bf5d/68747470733a2f2f706f7365722e707567782e6f72672f72756e64697a2f646174652d696e74657276616c2f762f737461626c65)](https://packagist.org/packages/rundiz/date-interval)[![License](https://camo.githubusercontent.com/d14eea3b48b5d53b510747667c45ebed33208411c62a9d6cac3489a7f1cfd813/68747470733a2f2f706f7365722e707567782e6f72672f72756e64697a2f646174652d696e74657276616c2f6c6963656e7365)](https://packagist.org/packages/rundiz/date-interval)[![Total Downloads](https://camo.githubusercontent.com/dadab2fb29498da73e3b2dc58a8d5fa77530fbcca4572035485766f25bbd4135/68747470733a2f2f706f7365722e707567782e6f72672f72756e64697a2f646174652d696e74657276616c2f646f776e6c6f616473)](https://packagist.org/packages/rundiz/date-interval)

For example: begining date is 2019-03-01; start displaying date is 2019-03-02; interval and range is every **3 days**; the exactly start displaying date should be 2019-03-04.

```
$date_begins = '2018-08-01';
$date_end = '2018-12-31';
$interval_num = 10;
$interval_unit = 'D';

$DateInterval = new \Rundiz\DateInterval\DateInterval();
$DateInterval->date_begins = $date_begins;
$DateInterval->date_end = $date_end;
$DateInterval->setInterval($interval_num, $interval_unit);

$list_dates = $DateInterval->getTheDates();

if ($list_dates == false || !is_array($list_dates)) {
    echo "\t".'Error!'."\n";
    // Displaying the error messages from class.
    foreach ($DateInterval->getErrorMessage() as $err_msg) {
        echo "\t\t".$err_msg.''."\n";
    }
    // Or!! if you want to use your custom error message, translation please use the code below instead.
    /*foreach ($DateInterval->getErrorCodes() as $err_code) {
        // for more, please read the docblock at `getErrorCodes()` method.
        switch ($err_code) {
            case 'RDDINTV_NO_DATE_BEGINS':
                echo 'There is no begins date or invalid format.'."\n";
                break;
            case 'RDDINTV_INCORRECT_DATE_BEGINS':
                echo 'The begins date value is incorrect.'."\n";
                break;
            case 'RDDINTV_NO_INTERVAL_RANGE':
                echo 'Please enter interval or range in setInterval() method.'."\n";
                break;
            default:
                echo 'Unknow error!'."\n";
                break;
        }
    }*/
} else {
    foreach ($list_dates as $each_date) {
        echo "\t".$each_date.''."\n";
    }
}
```

From the code above, the result will be:

> 2018-08-01
> 2018-08-11
> 2018-08-21
> 2018-08-31
> 2018-09-10
> 2018-09-20
> 2018-09-30
> 2018-10-10
> 2018-10-20
> 2018-10-30
> 2018-11-09
> 2018-11-19
> 2018-11-29
> 2018-12-09
> 2018-12-19
> 2018-12-29

And if you add more specific to start and stop date.

```
$DateInterval->getTheDates('2018-10-05', '2018-11-30');
```

From the code above, the result will be:

> 2018-10-10
> 2018-10-20
> 2018-10-30
> 2018-11-09
> 2018-11-19
> 2018-11-29

For more example, please look in tests folder.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance45

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1031 days

Total

3

Last Release

1614d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1568262?v=4)[vee w,](/maintainers/ve3)[@ve3](https://github.com/ve3)

---

Top Contributors

[![ve3](https://avatars.githubusercontent.com/u/1568262?v=4)](https://github.com/ve3 "ve3 (18 commits)")

---

Tags

dateintervalrangedatescheduleintervaldate-rangedate-intervaldate repeatrepeat eventweek intervalmonth intervalyear interval

### Embed Badge

![Health badge](/badges/rundiz-date-interval/health.svg)

```
[![Health](https://phpackages.com/badges/rundiz-date-interval/health.svg)](https://phpackages.com/packages/rundiz-date-interval)
```

###  Alternatives

[dragonmantank/cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due

4.7k474.1M487](/packages/dragonmantank-cron-expression)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[florianv/business

DateTime calculations in business hours

359775.9k1](/packages/florianv-business)[kartik-v/yii2-date-range

An advanced Yii 2 date range picker input for based on bootstrap-daterangepicker plugin.

894.4M42](/packages/kartik-v-yii2-date-range)[symfony/scheduler

Provides scheduling through Symfony Messenger

8810.8M52](/packages/symfony-scheduler)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
