PHPackages                             herrera-io/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. herrera-io/date-interval

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

herrera-io/date-interval
========================

Provides additional functionality to the DateInterval class.

1.2.0(13y ago)1530.5k↓34.3%7[1 PRs](https://github.com/kherge-archive/php-date-interval/pulls)2MITPHPPHP &gt;=5.3

Since Feb 8Pushed 13y agoCompare

[ Source](https://github.com/kherge-archive/php-date-interval)[ Packagist](https://packagist.org/packages/herrera-io/date-interval)[ Docs](http://herrera-io.github.com/php-date-interval)[ RSS](/packages/herrera-io-date-interval/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (4)Used By (2)

DateInterval
============

[](#dateinterval)

[![Build Status](https://camo.githubusercontent.com/0c78bd85c06c93d3c13dafaeebb71c6a2c63af921edd40c87e662a09a492a621/68747470733a2f2f7472617669732d63692e6f72672f686572726572612d696f2f7068702d646174652d696e74657276616c2e706e67)](http://travis-ci.org/herrera-io/php-date-interval)

Provides additional functionality to the DateInterval class.

Summary
-------

[](#summary)

The `DateInterval` class builds on the existing `DateInterval` class provided by PHP. With the new class, you may

- convert `DateInterval` to the [interval spec](http://php.net/manual/en/dateinterval.construct.php)
- convert `DateInterval` to the number of seconds
    - convert back to `DateInterval` from the number of seconds

> The conversion to seconds requires [a bit of explaining](https://github.com/herrera-io/php-date-interval/wiki/API#wiki-toSeconds).

Installation
------------

[](#installation)

Add it to your list of Composer dependencies:

```
$ composer require herrera-io/date-interval=1.*
```

Usage
-----

[](#usage)

```
