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

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

techlang/date
=============

PHP DateTime extension

2.0(3y ago)37.1kMITPHPPHP &gt;=8.0.0

Since Jun 13Pushed 3y ago2 watchersCompare

[ Source](https://github.com/techlang/date)[ Packagist](https://packagist.org/packages/techlang/date)[ Docs](https://github.com/techlang/date)[ RSS](/packages/techlang-date/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

\\TechLang\\DateTime
====================

[](#techlangdatetime)

[![Build Status](https://camo.githubusercontent.com/e48f1d5dd84c10659319ef74d9946538ca6455cce02412d674f76ab99769b9bd/68747470733a2f2f7472617669732d63692e6f72672f746563686c616e672f646174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/techlang/date)[![Coverage Status](https://camo.githubusercontent.com/fa9f99c9e45a85f4b9879ed74b5c91c46118359a002c4bce16ccc3c41be6eb35/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f746563686c616e672f646174652e737667)](https://coveralls.io/r/techlang/date)[![Latest Stable Version](https://camo.githubusercontent.com/5abd6e6e2f477d0019f23e1edfdc8916cbd3d7cead2a9dddae6befbed6a4aac5/68747470733a2f2f706f7365722e707567782e6f72672f746563686c616e672f646174652f762f737461626c652e737667)](https://packagist.org/packages/techlang/date)[![Latest Unstable Version](https://camo.githubusercontent.com/f98bc00a2d46b9e37e4e90d5570fe064fe2e500e76d31e021f46c130c64f2cbd/68747470733a2f2f706f7365722e707567782e6f72672f746563686c616e672f646174652f762f756e737461626c652e737667)](https://packagist.org/packages/techlang/date)[![Total Downloads](https://camo.githubusercontent.com/1a5e5c44474afcfa6a319b23c287f74b65bcb864b4d13d720f285c6681746f78/68747470733a2f2f706f7365722e707567782e6f72672f746563686c616e672f646174652f646f776e6c6f6164732e737667)](https://packagist.org/packages/techlang/date)[![License](https://camo.githubusercontent.com/5fc77d281233a982255d3c8295345a6e2f75f841412c0691bf94c1a7dad7cd58/68747470733a2f2f706f7365722e707567782e6f72672f746563686c616e672f646174652f6c6963656e73652e737667)](https://packagist.org/packages/techlang/date)

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

[](#introduction)

Enhance DateTime objects to add calendar months. What this means is that it will keep the day of the month and only modify month number. If the resulting month does not have that day (for example 31 February) it will use the highest day available for that month.

Examples
--------

[](#examples)

- adding a month 6 times; Jan. 31st scenario

```
$date = new \TechLang\DateTime('2000-01-31');
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2000-02-29
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2000-03-31
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2000-04-30
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2000-05-31
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2000-06-30
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2000-07-31
// and so on
```

- adding a month 6 times; Jan. 30th scenario

```
$date = new \TechLang\DateTime('2001-01-30');
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2001-02-28
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2001-03-30
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2001-04-30
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2001-05-30
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2001-06-30
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2001-07-30
// and so on
```

- adding 2 months

```
$date = \TechLang\DateTime::createFromFormat('Y-m-d', '2000-12-31');
$date->add(new \DateInterval('P2M'));
echo $date->format('Y-m-d');
// this will output: 2001-02-28
```

- add anything lower than month, and you loose the initial date

```
$date = new \TechLang\DateTime('2000-11-30');
$date->add(new \DateInterval('P1M2D'));
echo $date->format('Y-m-d'); // -> 2001-01-01

// because we added 2 days the date is now 2000-01-01 and the original day of 30 is lost
$date->add(new \DateInterval('P1M'));
echo $date->format('Y-m-d'); // -> 2001-02-01
```

Future development
------------------

[](#future-development)

- implement `sub` method

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Total

3

Last Release

1188d ago

Major Versions

1.1 → 2.02023-02-14

PHP version history (2 changes)1.0PHP &gt;=5.3.0

2.0PHP &gt;=8.0.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7870890?v=4)[TechLang Software](/maintainers/techlang)[@techlang](https://github.com/techlang)

![](https://avatars.githubusercontent.com/u/1682645?v=4)[Ionut DINU](/maintainers/tunder)[@tunder](https://github.com/tunder)

---

Top Contributors

[![tunder](https://avatars.githubusercontent.com/u/1682645?v=4)](https://github.com/tunder "tunder (2 commits)")

---

Tags

datetimetimedate

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[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)

PHPackages © 2026

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