PHPackages                             vascowhite/datefactory - 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. vascowhite/datefactory

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

vascowhite/datefactory
======================

A factory class for DateTime objects.

v1.1.1(9y ago)018GPL-3.0PHP

Since Dec 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/vascowhite/DateFactory)[ Packagist](https://packagist.org/packages/vascowhite/datefactory)[ RSS](/packages/vascowhite-datefactory/feed)WikiDiscussions 1.1.1 Synced 1mo ago

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

\#DateFactory A factory for `\DateTime` objects with checks that the date string supplied matches the format supplied.

\##Installation Install using composer, add the following to composer.json:-

```
"require": {
    "vascowhite/datefactory": "v1.1.x"
}
```

\##Why Because `\DateTime::createFromFormat()` does [stupid things](http://3v4l.org/9qavI) and I needed a way of doing server side validation on user supplied dates.

\##DateFactory There is just one public method:

\####DateFactory::getDate() **Signature:-**

```
DateTime DateFactory::getDate(String $date, String $format, [String $timeZone])
```

**Arguments**`$date` is a string representing a date/time, e.g. '2014-14 14:12:10'. `$format` Format string. Available formats are any available for [`\DateTime::createFromFormat()`](http://php.net/manual/en/datetime.createfromformat.php). `$timeZone` Optional. A valid Time Zone identifier from [this list](http://php.net/manual/en/timezones.php).

**Example**

```
$dateTime = DateFactory::getDate('2014-12-25 12:00:00',  'Y-m-d H:i:s', 'Europe/London');
```

**Return**Returns a `DateTime` object or false on failure.

---

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

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

Recently: every ~167 days

Total

8

Last Release

3500d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/22130051017ac7053fbf5dd94d944ec0e73d7c065dd62ca657e6fc2dd7c5639e?d=identicon)[vascowhite](/maintainers/vascowhite)

---

Top Contributors

[![vascowhite](https://avatars.githubusercontent.com/u/874109?v=4)](https://github.com/vascowhite "vascowhite (20 commits)")

---

Tags

datetime

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vascowhite-datefactory/health.svg)

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

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.

9201.2M45](/packages/morilog-jalali)[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)

PHPackages © 2026

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