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

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

joaomfrebelo/date
=================

A library that relays on the PHP DateTime class, but differs in the return types and add useful functions

3.0.0(2y ago)0284↓50%[1 PRs](https://github.com/joaomfrebelo/Date/pulls)3MITPHPPHP ^8.3.0CI passing

Since Apr 19Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/joaomfrebelo/Date)[ Packagist](https://packagist.org/packages/joaomfrebelo/date)[ Docs](https://github.com/joaomfrebelo/Date)[ RSS](/packages/joaomfrebelo-date/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (9)Used By (3)

Rebelo\\Date
============

[](#rebelodate)

This class relays on the DateTime class of php but change the return type for some methods and have more methods. Methods like add and sub return a new Object instead of change the instance itself. This class have methods like addDays, addMonths, addYears, addHours, etc

Example
-------

[](#example)

Initiate an instance of \\Rebelo\\Date\\Date

```
    $date = \Rebelo\Date\Date::parse(
        \Rebelo\Date\Date::SQL_DATETIME, "1969-10-05 09:00:00"
    );

    OR

    $date = \Rebelo\Date\Date::createFromFormat(
        \Rebelo\Date\Pattern::DATE_TIME,
        "1969-10-05 09:00:00",
        new \DateTimeZone("Europe/Lisbon")
    );

    OR for Date now

    $date = new \Rebelo\Date\Date();

    OR get Date from NTP server

    $date = \Rebelo\Date\Date::ntp();
```

Get a formatted string

```
$string = $date->format(\Rebelo\Date\Pattern::SQL_DATE)
```

Add and Subtract Years

```
$date2 = $date->addYears(50);
$date3 = $date->addYears(-9)
```

Set the Month

```
$date->setMonth(9)
```

Install
-------

[](#install)

Via Composer

```
$ composer require joaomfrebelo/Date
```

License
-------

[](#license)

MIT License Copyright (c) 2019 João M F Rebelo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance54

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 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 ~298 days

Recently: every ~357 days

Total

7

Last Release

787d ago

Major Versions

1.0.0 → 2.0.02020-03-07

2.2.2 → 3.0.02024-03-13

PHP version history (4 changes)1.0.0PHP ^7.2

2.0.0PHP ^7.4

2.2.2PHP ^7.4 || ^8.0

3.0.0PHP ^8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/909b2a0bdc281c7125fc264a04f0da1538f16cbad859501919565f8e21dde18d?d=identicon)[joaomfrebelo](/maintainers/joaomfrebelo)

---

Top Contributors

[![joaomfrebelo](https://avatars.githubusercontent.com/u/2965955?v=4)](https://github.com/joaomfrebelo "joaomfrebelo (10 commits)")

---

Tags

phpdatetime

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[kartik-v/php-date-formatter

A Javascript datetime formatting and manipulation library using PHP date-time formats.

461.5M3](/packages/kartik-v-php-date-formatter)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)[zjkal/time-helper

一个简单快捷的PHP日期时间助手类库。 a smart PHP datetime helper library.

21128.6k1](/packages/zjkal-time-helper)

PHPackages © 2026

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