PHPackages                             hrevert/ht-time-zone - 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. hrevert/ht-time-zone

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

hrevert/ht-time-zone
====================

HtTimeZone is a Zend Framework 2 module to simplify working with timezones. This module is useful when your application users are located all around the world.

348[1 issues](https://github.com/hrevert/HtTimeZone/issues)[1 PRs](https://github.com/hrevert/HtTimeZone/pulls)PHP

Since Apr 25Pushed 11y ago2 watchersCompare

[ Source](https://github.com/hrevert/HtTimeZone)[ Packagist](https://packagist.org/packages/hrevert/ht-time-zone)[ RSS](/packages/hrevert-ht-time-zone/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (4)Used By (0)

HtTimeZone
==========

[](#httimezone)

HtTimeZone is a Zend Framework 2 module to simplify working with timezones. This module is useful when your application users are located all around the world. To use this module you will have to store all the dates in a fixed timezone(UTC is recommended).

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

[](#installation)

1. Add `"hrevert/ht-time-zone": "dev-master",` to your composer.json and run `php composer.phar update`
2. Enable the module in `config/application.config.php`
3. Copy file located in `./vendor/hrevert/ht-time-zone/config/ht-time-zone.global.php` to `./config/autoload/ht-time-zone.global.php` and change the values as you wish

Documentation
-------------

[](#documentation)

### Doctrine Types

[](#doctrine-types)

If you use doctrine DBAL, then you can use DBAL types provided this module which automate timezone conversion.

#### Included DBAL types

[](#included-dbal-types)

1. [`HtTimeZone\DBAL\Types\UTCDateTimeType`](https://github.com/hrevert/HtTimeZone/tree/master/src/DBAL/Types/UTCDateTimeType.php)
2. [`HtTimeZone\DBAL\Types\UTCTimeType`](https://github.com/hrevert/HtTimeZone/tree/master/src/DBAL/Types/UTCTimeType.php)
3. [`HtTimeZone\DBAL\Types\TimeZoneType`](https://github.com/hrevert/HtTimeZone/tree/master/src/DBAL/Types/TimeZoneType.php)

Usage
-----

[](#usage)

```
/**
 * @Entity
 * @Table(name="myEvent)
 */
class Event
{
    ...

    /**
     * @Column(type="UTCDateTime")
     * @var DateTime
     */
     protected $datetime;

    ...
}
```

Suppose, you want to store user's timezone;

```
