PHPackages                             smirik/php-datetime-ago - 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. smirik/php-datetime-ago

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

smirik/php-datetime-ago
=======================

How much time ago in text format

v1.1.0(10y ago)22156.6k↓24.5%5[1 issues](https://github.com/smirik/php-datetime-ago/issues)[2 PRs](https://github.com/smirik/php-datetime-ago/pulls)MITPHPPHP &gt;=5.3.3

Since Jul 22Pushed 7y ago3 watchersCompare

[ Source](https://github.com/smirik/php-datetime-ago)[ Packagist](https://packagist.org/packages/smirik/php-datetime-ago)[ RSS](/packages/smirik-php-datetime-ago/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

php-datetime-ago
================

[](#php-datetime-ago)

This library helps to format the date/time interval into text.

Examples
--------

[](#examples)

ConditionTextNownowLess than an hourxx minutes agoBetween 1 and 2 hours1 hour agoBetween 2 and 24 hoursxx hours agoBetween 1 and 2 days1 day agoBetween 2 and 6 daysxx days ago7 or more days agoxx weeks ago30 or more days agoxx months ago365 or more days agoxx years agoNotice that not every translator supports weeks, months and years

Usage
-----

[](#usage)

`DateTimeAgo` class has public method `get`. It accepts 1 required argument (`\DateTime` object) and 1 optional (reference date. If it is `null`, current time is used).

```
