PHPackages                             shapecode/doctrine-dbal-datetimeutc - 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. [Database &amp; ORM](/categories/database)
4. /
5. shapecode/doctrine-dbal-datetimeutc

ActiveLibrary[Database &amp; ORM](/categories/database)

shapecode/doctrine-dbal-datetimeutc
===================================

A custom Doctine DBAL type to use PHP DateTime objects set to the UTC timezone.

5.0.0(2y ago)12.3k1MITPHPPHP ^8.2CI passing

Since Nov 27Pushed 8mo agoCompare

[ Source](https://github.com/shapecode/doctrine-dbal-datetimeutc)[ Packagist](https://packagist.org/packages/shapecode/doctrine-dbal-datetimeutc)[ GitHub Sponsors](http://github.com/sponsors/nicklog)[ Fund](https://liberapay.com/nicklog)[ RSS](/packages/shapecode-doctrine-dbal-datetimeutc/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (11)Versions (7)Used By (1)

doctrine-dbal-datetimeutc
=========================

[](#doctrine-dbal-datetimeutc)

[![paypal](https://camo.githubusercontent.com/863cb4528d59447a96106e65c87541c857b3cc163ba9dd39edb9050bb5090618/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617970616c2d626c75652e737667)](http://paypal.me/nloges)

[![PHP Version](https://camo.githubusercontent.com/cde80bd61029103babb6918cf808e809e8fe79cbc367dbd5c32673f60288b35d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7368617065636f64652f646f637472696e652d6462616c2d6461746574696d657574632e737667)](https://packagist.org/packages/shapecode/doctrine-dbal-datetimeutc)[![Latest Stable Version](https://camo.githubusercontent.com/7a35f60740ca5584c62e045c84c55876f1323e71a1ed9d95468c05e79f9a0183/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368617065636f64652f646f637472696e652d6462616c2d6461746574696d657574632e7376673f6c6162656c3d737461626c65)](https://packagist.org/packages/shapecode/doctrine-dbal-datetimeutc)[![Latest Unstable Version](https://camo.githubusercontent.com/e58b6032065b2fc8a799be20eed1d0c70ea36f5eb3d521a13d1c0a468f430adf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f7368617065636f64652f646f637472696e652d6462616c2d6461746574696d657574632e7376673f6c6162656c3d756e737461626c65)](https://packagist.org/packages/shapecode/doctrine-dbal-datetimeutc)[![Total Downloads](https://camo.githubusercontent.com/da24fd635ddc6c4136de5bf31fc58fe47b115f6f94a12912c03e6e6f0f6dc7ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7368617065636f64652f646f637472696e652d6462616c2d6461746574696d657574632e737667)](https://packagist.org/packages/shapecode/doctrine-dbal-datetimeutc)[![Monthly Downloads](https://camo.githubusercontent.com/7063b8ea351049ec771ec2c1efceaab1ae7d2d99ccc690c80674ceb7d3d75152/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f7368617065636f64652f646f637472696e652d6462616c2d6461746574696d657574632e737667)](https://packagist.org/packages/shapecode/doctrine-dbal-datetimeutc)[![Daily Downloads](https://camo.githubusercontent.com/502a701550412f40608d29d83ba0868f6bf632ccf390711343528541b1b63277/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f7368617065636f64652f646f637472696e652d6462616c2d6461746574696d657574632e737667)](https://packagist.org/packages/shapecode/doctrine-dbal-datetimeutc)[![License](https://camo.githubusercontent.com/afc2411de71ee674e8f344515369ea22d43815b3f5a40aa98fb63bb32be22b20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7368617065636f64652f646f637472696e652d6462616c2d6461746574696d657574632e737667)](https://packagist.org/packages/shapecode/cron-bundle)

A Doctrine DBAL [Custom Mapping Type](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/custom-mapping-types.html) allowing the use of PHP DateTime objects automatically set to the UTC timezone.

Databases [suck at timezones](http://derickrethans.nl/storing-date-time-in-database.html). The best way to deal with this is to store the date and time in UTC and separately store the timezone that should be used for display purposes. By default, PHP will create DateTime objects set the server's timezone. This custom type overrides this to set the timezone to UTC, allowing you to later convert to the proper timezone for display.

Install via composer:

```
composer req shapecode/doctrine-dbal-datetimeutc
```

Add the custom type before instantiating your entity manager:

```
use Doctrine\DBAL\Types\Type;
use Shapecode\Doctrine\DBAL\Types\DateTimeUTCType;

Type::addType(DateTimeUTCType::DATETIMEUTC, DateTimeUTCType::class);
```

Enjoy!

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance43

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~739 days

Total

6

Last Release

870d ago

Major Versions

1.0.0 → 2.0.02016-02-24

2.0.0 → 3.0.02020-12-31

3.1.0 → 4.0.02023-12-02

4.0.0 → 5.0.02024-04-01

PHP version history (5 changes)1.0.0PHP &gt;=5.3.2

2.0.0PHP &gt;=5.5

3.0.0PHP ^7.3|^8.0

3.1.0PHP ^8.1

4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/aa5022bc04220e19fd14f86fd9db50a3a1ddc1808cc282f79ffe0fff181359c8?d=identicon)[Nicklog](/maintainers/Nicklog)

---

Top Contributors

[![austinsmorris](https://avatars.githubusercontent.com/u/1616868?v=4)](https://github.com/austinsmorris "austinsmorris (13 commits)")[![nicklog](https://avatars.githubusercontent.com/u/462920?v=4)](https://github.com/nicklog "nicklog (10 commits)")[![mrkrstphr](https://avatars.githubusercontent.com/u/164472?v=4)](https://github.com/mrkrstphr "mrkrstphr (4 commits)")

---

Tags

doctrinedbaldatetimeutc

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/shapecode-doctrine-dbal-datetimeutc/health.svg)

```
[![Health](https://phpackages.com/badges/shapecode-doctrine-dbal-datetimeutc/health.svg)](https://phpackages.com/packages/shapecode-doctrine-dbal-datetimeutc)
```

###  Alternatives

[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4566.0M4](/packages/martin-georgiev-postgresql-for-doctrine)[flow-php/doctrine-dbal-bulk

Bulk inserts and updates for Doctrine DBAL

14404.6k5](/packages/flow-php-doctrine-dbal-bulk)[austinsmorris/doctrine-dbal-datetimeutc

A custom Doctine DBAL type to use PHP DateTime objects set to the UTC timezone.

10136.3k1](/packages/austinsmorris-doctrine-dbal-datetimeutc)[vasek-purchart/doctrine-date-time-immutable-types

Doctrine DateTimeImmutable types

45230.5k](/packages/vasek-purchart-doctrine-date-time-immutable-types)[sllh/doctrine-dbal-utc-datetime

UTC DateTime type for Doctrine DBAL

1137.5k](/packages/sllh-doctrine-dbal-utc-datetime)[vasek-purchart/doctrine-date-time-immutable-types-bundle

Bundle integration of Doctrine DateTimeImmutable types for Symfony

1085.7k](/packages/vasek-purchart-doctrine-date-time-immutable-types-bundle)

PHPackages © 2026

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