PHPackages                             leviferreira/melody-datetime - 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. leviferreira/melody-datetime

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

leviferreira/melody-datetime
============================

PHP's DateTime extension

113245[2 issues](https://github.com/leviferreira/melody-datetime/issues)PHP

Since Dec 28Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Melody Datetime
===============

[](#melody-datetime)

[![Join the chat at https://gitter.im/project-melody/datetime](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/project-melody/datetime?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status](https://camo.githubusercontent.com/72e191e1db6cf587aea56ccb7aa4f22c8a32eb7b219e427cbea6b5536bf1ebea/68747470733a2f2f7472617669732d63692e6f72672f70726f6a6563742d6d656c6f64792f6461746574696d652e706e673f6272616e63683d646576656c6f70)](https://travis-ci.org/project-melody/datetime)

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

[](#installation)

The recommended way to install Melody DateTime is [through composer](http://getcomposer.org). Just create a `composer.json` file and run the `php composer.phar install` command to install it:

```
    {
        "require": {
            "project-melody/datetime": "dev-master"
        }
    }
```

Introduction
------------

[](#introduction)

Importing DateTime namespace:

```
use Melody\DateTime\DateTime;
```

Basic Usage
-----------

[](#basic-usage)

### Adding business days to a date

[](#adding-business-days-to-a-date)

```
    // Sets the datetime, will consider the 'now' date
    // for example: 2013-12-01 00:00:00
    $datetime = new DateTime();

    // add two business days to a date
    $datetime->addBusinessDays(2);

    // Output: 2013-12-03 00:00:00
    echo $datetime->format('Y-m-d H:i:s');
```

### Adding business days to a date, considering holidays

[](#adding-business-days-to-a-date-considering-holidays)

```
    // Sets the datetime, will consider the 'now' date
    // for example: 2013-12-01 00:00:00
    $datetime = new DateTime();

    // Set a list of holidays that will be considered
    $datetime->setHolidays(array('2013-12-02'));

    // Add two business days to a date, considering holidays as non-business days
    $datetime->addBusinessDaysWithHolidays(2);

    // Output: 2013-12-04 00:00:00
    echo $datetime->format('Y-m-d H:i:s');
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.4% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3765253?v=4)[Levi Ferreira](/maintainers/leviferreira)[@leviferreira](https://github.com/leviferreira)

---

Top Contributors

[![leviferreira](https://avatars.githubusercontent.com/u/3765253?v=4)](https://github.com/leviferreira "leviferreira (29 commits)")[![rogeriopradoj](https://avatars.githubusercontent.com/u/443391?v=4)](https://github.com/rogeriopradoj "rogeriopradoj (7 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

### Embed Badge

![Health badge](/badges/leviferreira-melody-datetime/health.svg)

```
[![Health](https://phpackages.com/badges/leviferreira-melody-datetime/health.svg)](https://phpackages.com/packages/leviferreira-melody-datetime)
```

###  Alternatives

[liquidweb/htaccess-validator-shell

Shell script for linting and validating Apache2 Htaccess files

1750.1k1](/packages/liquidweb-htaccess-validator-shell)

PHPackages © 2026

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