PHPackages                             utcdatetime/utcdatetime - 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. utcdatetime/utcdatetime

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

utcdatetime/utcdatetime
=======================

Provides a datetime-implementation that is always UTC

1.1.1(6y ago)4283[1 issues](https://github.com/heiglandreas/UTCDateTime/issues)[1 PRs](https://github.com/heiglandreas/UTCDateTime/pulls)MITPHPPHP ^7.0CI failing

Since Oct 31Pushed 5y ago1 watchersCompare

[ Source](https://github.com/heiglandreas/UTCDateTime)[ Packagist](https://packagist.org/packages/utcdatetime/utcdatetime)[ Docs](http://github.com/heiglandreas/UTCDateTime)[ RSS](/packages/utcdatetime-utcdatetime/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (8)Used By (0)

UTCDateTime
===========

[](#utcdatetime)

A small library that always uses UTC for your DateTime-Objects no matter what you input.

[![Build Status](https://camo.githubusercontent.com/d98dc286325b25e035797a41b4599c33c0de907e305b84d172d5eaaa78b216de/68747470733a2f2f7472617669732d63692e6f72672f686569676c616e64726561732f5554434461746554696d652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/heiglandreas/UTCDateTime)[![Code Climate](https://camo.githubusercontent.com/798ac3113aff310e6dae1b7aa545221a2a1970f3e950a6e5ccaa58603611429f/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f686569676c616e64726561732f5554434461746554696d652f6261646765732f6770612e737667)](https://codeclimate.com/github/heiglandreas/UTCDateTime)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e93518bdbeebb9a29180ed4558ad9a91f845798b8e21581eedb32d6467689e35/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686569676c616e64726561732f5554434461746554696d652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/heiglandreas/UTCDateTime/?branch=master)

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

[](#installation)

UTCDateTime is installed via composer. Call `composer require utcdatetime/utcdatetime` from the commandline in your project.

Alternatively you can include the following line in your `composer.json` inside the `require`-section:

```
"utcdatetime/utcdatetime" : "stable"

```

Usage
-----

[](#usage)

Use the UTCDateTime- or UTCDateTimeImmutable-Object just like PHPs own DateTime-Objects. You do not have to rewrite any productive code. Just add `use UTCDateTime/DateTime` resp. `use UTCDateTime\DateTimeimmutable` to the `use`-section of your PHP-file. That will cause PHP to use the UTCDateTime-Objects instead of the PHP-Internal DateTime-Objects.

Calls to `setTimeZone` will be ignored, all other calls will be executed just as before. The only difference will be, that no matter what you put into the DateTime-Objects, it will always contain the UTC-representation of your date. And there is no way to change that.

So any Datetime-data will always be correctly converted to UTC and you can then work with that like so:

```
use UTCDateTime\DateTime;
$date = new DateTime('2014-11-03 12:34:56', new DateTimeZone('Europe/Berlin'));
echo $date->format(DateTime::RFC3339);
// 2014-11-03T10:34:56+00:00

```

Additional Constants
--------------------

[](#additional-constants)

This package also introduce some more formating-constants.

Those include:

- DateTime::RFC7231 for formatting date according to RFC 7231
- DateTime::PDF for formatting dates for internal PDF-Storage

Licence
-------

[](#licence)

This code is licensed under the MIT-License.

Contributing
------------

[](#contributing)

Contributions are always welcome. Fork the repo, do whatever you like and open a pull request!

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 93.8% 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 ~552 days

Total

4

Last Release

2551d ago

Major Versions

v0.1 → 1.0.02014-11-03

PHP version history (2 changes)1.0.0PHP &gt;=5.4

1.1.0PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ae5183aaad2bc7453230704bd6991dc6ccbcd6e775c6a29efdc94350a69f247?d=identicon)[heiglandreas](/maintainers/heiglandreas)

---

Top Contributors

[![heiglandreas](https://avatars.githubusercontent.com/u/91998?v=4)](https://github.com/heiglandreas "heiglandreas (30 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

datetimeutcGMT

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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.3M60](/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)
