PHPackages                             eden/timezone - 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. eden/timezone

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

eden/timezone
=============

Eden timezone component.

4.0.1(10y ago)08.4k1MITPHPPHP &gt;=5.4.1

Since Sep 24Pushed 10y ago12 watchersCompare

[ Source](https://github.com/Eden-PHP/Timezone)[ Packagist](https://packagist.org/packages/eden/timezone)[ Docs](http://eden-php.com)[ RSS](/packages/eden-timezone/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (1)

[![logo](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67)](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67) Eden Timezone
===================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-eden-timezone)

[![Build Status](https://camo.githubusercontent.com/6af49ec57748f8f017c9d3f642c5943422669e0347f3122de3b8614f9888aecb/68747470733a2f2f6170692e7472617669732d63692e6f72672f4564656e2d5048502f54696d657a6f6e652e737667)](https://travis-ci.org/Eden-PHP/Timezone)
==============================================================================================================================================================================================================================================================

[](#)

- [Install](#install)
- [Introduction](#intro)
- [API](#api)
    - [convertTo](#convertTo)
    - [getGMT](#getGMT)
    - [getGMTDates](#getGMTDates)
    - [getOffset](#getOffset)
    - [getOffsetDates](#getOffsetDates)
    - [getTime](#getTime)
    - [getUTC](#getUTC)
    - [getUTCDates](#getUTCDates)
    - [toRelative](#toRelative)
    - [setTime](#setTime)
    - [validation](#validation)
- [Contributing](#contributing)

====

Install
-------

[](#install)

`composer install eden/timezone`

====

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

[](#introduction)

Instantiate timezone in this manner.

```
$timezone = eden('timezone', time(), 'GMT');

```

====

API
---

[](#api)

====

### convertTo

[](#convertto)

Convert current time set here to another time zone

#### Usage

[](#usage)

```
eden('timezone', time(), 'GMT')->convertTo(*string $zone, string|null $format);

```

#### Parameters

[](#parameters)

- `*string $zone` - valid UTC, GMT, PHP Location or TZ Abbreviation
- `string|null $format` - format

Returns `string|int`

#### Example

[](#example)

```
eden('timezone', time(), 'GMT')->convertTo('Asia/Manila');

```

====

### getGMT

[](#getgmt)

Returns the GMT Format

#### Usage

[](#usage-1)

```
eden('timezone', time(), 'GMT')->getGMT(string $prefix);

```

#### Parameters

[](#parameters-1)

- `string $prefix` - Prefix to add before the returned value

Returns `string`

#### Example

[](#example-1)

```
eden('timezone', time(), 'GMT')->getGMT();

```

====

### getGMTDates

[](#getgmtdates)

Returns a list of GMT formats and dates in a 24 hour period

#### Usage

[](#usage-2)

```
eden('timezone', time(), 'GMT')->getGMTDates(*string $format, int $interval, string|null $prefix);

```

#### Parameters

[](#parameters-2)

- `*string $format` - The format of each date to display
- `int $interval` - The frequency of rows
- `string|null $prefix` - The prefix to add before each date display

Returns `array`

#### Example

[](#example-2)

```
eden('timezone', time(), 'GMT')->getGMTDates('F d, Y');

```

====

### getOffset

[](#getoffset)

Returns the current offset of this timezone

#### Usage

[](#usage-3)

```
eden('timezone', time(), 'GMT')->getOffset();

```

#### Parameters

[](#parameters-3)

Returns `int`

====

### getOffsetDates

[](#getoffsetdates)

Returns a list of offsets and dates in a 24 hour period

#### Usage

[](#usage-4)

```
eden('timezone', time(), 'GMT')->getOffsetDates(*string $format, int $interval);

```

#### Parameters

[](#parameters-4)

- `*string $format` - The format of each date to display
- `int $interval` - The frequency of rows

Returns `array`

#### Example

[](#example-3)

```
eden('timezone', time(), 'GMT')->getOffsetDates('F d, Y');

```

====

### getTime

[](#gettime)

Returns the time or date

#### Usage

[](#usage-5)

```
eden('timezone', time(), 'GMT')->getTime(string|null $format);

```

#### Parameters

[](#parameters-5)

- `string|null $format` - Time format

Returns `string|int`

#### Example

[](#example-4)

```
eden('timezone', time(), 'GMT')->getTime();

```

====

### getUTC

[](#getutc)

Returns the UTC Format

#### Usage

[](#usage-6)

```
eden('timezone', time(), 'GMT')->getUTC(string|null $prefix);

```

#### Parameters

[](#parameters-6)

- `string|null $prefix` - The prefix to add before the returned value

Returns `string`

#### Example

[](#example-5)

```
eden('timezone', time(), 'GMT')->getUTC();

```

====

### getUTCDates

[](#getutcdates)

Returns a list of UTC formats and dates in a 24 hour period

#### Usage

[](#usage-7)

```
eden('timezone', time(), 'GMT')->getUTCDates(*string $format, int $interval, string|null $prefix);

```

#### Parameters

[](#parameters-7)

- `*string $format` - The format of each date to display
- `int $interval` - The frequency of rows
- `string|null $prefix` - The prefix to add before each date display

Returns `array`

#### Example

[](#example-6)

```
eden('timezone', time(), 'GMT')->getUTCDates('F d, Y');

```

====

### toRelative

[](#torelative)

Returns the relative distance $time &gt; this-&gt;time = ago

#### Usage

[](#usage-8)

```
eden('timezone', time(), 'GMT')->toRelative(int|string $time, int $level, string $default);

```

#### Parameters

[](#parameters-8)

- `int|string $time` - The time to make relative
- `int $level` - The granular level
- `string $default` - The default date format

Returns `Eden\Timezone\Index`

#### Example

[](#example-7)

```
eden('timezone', time(), 'GMT')->toRelative();

```

====

### setTime

[](#settime)

Sets a new time

#### Usage

[](#usage-9)

```
eden('timezone', time(), 'GMT')->setTime(*int|string $time);

```

#### Parameters

[](#parameters-9)

- `*int|string $time` - The time value

Returns `Eden\Timezone\Index`

#### Example

[](#example-8)

```
eden('timezone', time(), 'GMT')->setTime(time() + 123);

```

====

### validation

[](#validation)

Returns timezone's validation methods

#### Usage

[](#usage-10)

```
eden('timezone', time(), 'GMT')->validation();

```

#### Parameters

[](#parameters-10)

Returns `Eden\Timezone\Index`

====

\#Contributing to Eden

Contributions to *Eden* are following the Github work flow. Please read up before contributing.

\##Setting up your machine with the Eden repository and your fork

1. Fork the repository
2. Fire up your local terminal create a new branch from the `v4` branch of your fork with a branch name describing what your changes are. Possible branch name types:
    - bugfix
    - feature
    - improvement
3. Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")

\##Making pull requests

1. Please ensure to run `phpunit` before making a pull request.
2. Push your code to your remote forked version.
3. Go back to your forked version on GitHub and submit a pull request.
4. An Eden developer will review your code and merge it in when it has been classified as suitable.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 77.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 ~195 days

Total

5

Last Release

3832d ago

Major Versions

1.0.3 → 4.0.12015-10-13

PHP version history (2 changes)1.0.2PHP &gt;=5.3.1

4.0.1PHP &gt;=5.4.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/120378?v=4)[Christian Blanquera](/maintainers/cblanquera)[@cblanquera](https://github.com/cblanquera)

---

Top Contributors

[![clark21](https://avatars.githubusercontent.com/u/5639521?v=4)](https://github.com/clark21 "clark21 (7 commits)")[![Sherlonv](https://avatars.githubusercontent.com/u/5492326?v=4)](https://github.com/Sherlonv "Sherlonv (2 commits)")

---

Tags

libraryeden

### Embed Badge

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

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

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

69536.3M116](/packages/league-iso3166)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)[eden/core

Eden Core component full of secret sauce

14415.0k34](/packages/eden-core)

PHPackages © 2026

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