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

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

kamilkrzywda/date-interval
==========================

Provides additional functionality to the DateInterval class.

01PHP

Since Feb 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/kamilkrzywda/php-date-interval)[ Packagist](https://packagist.org/packages/kamilkrzywda/date-interval)[ RSS](/packages/kamilkrzywda-date-interval/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

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 kamilkrzywda/date-interval=1.*
```

Usage
-----

[](#usage)

```
