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

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

ionutrusen/timezone
===================

Helps manage timezones in Laravel. Includes &lt;select&gt; form builder for timezones.

v0.1(2y ago)098MITPHPPHP &gt;=5.4.0

Since Aug 7Pushed 1y agoCompare

[ Source](https://github.com/IonutRusen/timezone)[ Packagist](https://packagist.org/packages/ionutrusen/timezone)[ Docs](http://www.camroncade.com/managing-timezones-with-laravel/)[ RSS](/packages/ionutrusen-timezone/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Timezone Select Form Builder
============================

[](#timezone-select-form-builder)

Snatched from camroncade/timezone, fixed for my requirements ! This is a helper function that creates a select menu including timezones in human-readable format. Each underlying key is the php-friendly name for the timezone, making it easy to immediately store and use them. The array of timezones and their underlying keys were taken from the repository by [tamaspap](https://github.com/tamaspap/timezones).

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

[](#installation)

Recommended installation of this package is through composer. Include the following in your project's `composer.json` file:

```
"require": {
	"IonutRusen/timezone": "0.1"
}

```

Next, update Composer from the Terminal:

```
composer update

```

Once this operation completes, the final step is to add the service provider. Open `config/app.php`, and add a new item to the service providers array.

```
'IonutRusen\Timezone\TimezoneServiceProvider'

```

Now it's ready for use!

Usage
-----

[](#usage)

### Timezone Convert Helper Functions

[](#timezone-convert-helper-functions)

The package includes two helper functions that make it easy to deal with displaying and storing timezones, `convertFromUTC()` and `convertToUTC()`:

Each function accepts two required parameters and a third optional parameter dealing with the format of the returned timestamp.

```
Timezone::convertFromUTC($timestamp, $timezone, $format);
Timezone::convertToUTC($timestamp, $timezone, $format);

```

The first parameter accepts a timestamp, the second accepts the name of the timezone that you are converting to/from. The option values associated with the timezones included in the select form builder can be plugged into here as is. Alternatively, you can use any of [PHP's supported timezones](http://php.net/manual/en/timezones.php).

The third parameter is optional, and default is set to `'Y-m-d H:i:s'`, which is how Laravel natively stores datetimes into the database (the `created_at` and `updated_at` columns).

### Select Form Builder

[](#select-form-builder)

The package also includes a helper function for the creation of the select option. This is created by calling `Timezone::selectForm()`.

The method selectForm accepts four optional parameters, `string selected`, `placeholder`, `array formAttributes`, and `array optionAttributes`. An example of it's use is shown below:

```
$selected = 'US/Central';
$placeholder = 'Select a timezone';
$formAttributes = array('class' => 'swegForm', 'style' => 'float:left;', 'name' => 'timezone');
$optionAttributes = array('customValue' => 'true');

Timezone::selectForm($selected, $placeholder, $formAttributes, $optionAttributes);

```

Note that the `$selected` parameter matches the string to the values on each option, not the display text. The paratmeters `$formAttributes` and `$optionAttributes` can be used for styling, roles, and generally anything you need. This is useful for applying Twitter Bootstrap styling.

Simply returning `Timezone::selectForm()` will output the following:

```

(UTC-11:00) Midway Island
(UTC-11:00) Samoa
(UTC-10:00) Hawaii
(UTC-09:00) Alaska
(UTC-08:00) Pacific Time (US &amp; Canada)
(UTC-08:00) Tijuana
(UTC-07:00) Arizona
(UTC-07:00) Chihuahua
(UTC-07:00) La Paz
(UTC-07:00) Mazatlan
(UTC-07:00) Mountain Time (US &amp; Canada)
(UTC-06:00) Central America
(UTC-06:00) Central Time (US &amp; Canada)
(UTC-06:00) Guadalajara
(UTC-06:00) Mexico City
(UTC-06:00) Monterrey
(UTC-06:00) Saskatchewan
(UTC-05:00) Bogota
(UTC-05:00) Eastern Time (US &amp; Canada)
(UTC-05:00) Indiana (East)
(UTC-05:00) Lima
(UTC-05:00) Quito
(UTC-04:00) Atlantic Time (Canada)
(UTC-04:30) Caracas
(UTC-04:00) La Paz
(UTC-04:00) Santiago
(UTC-03:30) Newfoundland
(UTC-03:00) Brasilia
(UTC-03:00) Buenos Aires
(UTC-03:00) Georgetown
(UTC-03:00) Greenland
(UTC-02:00) Mid-Atlantic
(UTC-01:00) Azores
(UTC-01:00) Cape Verde Is.
(UTC+00:00) Casablanca
(UTC+00:00) Edinburgh
(UTC+00:00) Greenwich Mean Time : Dublin
(UTC+00:00) Lisbon
(UTC+00:00) London
(UTC+00:00) Monrovia
(UTC+00:00) UTC
(UTC+01:00) Amsterdam
(UTC+01:00) Belgrade
(UTC+01:00) Berlin
(UTC+01:00) Bern
(UTC+01:00) Bratislava
(UTC+01:00) Brussels
(UTC+01:00) Budapest
(UTC+01:00) Copenhagen
(UTC+01:00) Ljubljana
(UTC+01:00) Madrid
(UTC+01:00) Paris
(UTC+01:00) Prague
(UTC+01:00) Rome
(UTC+01:00) Sarajevo
(UTC+01:00) Skopje
(UTC+01:00) Stockholm
(UTC+01:00) Vienna
(UTC+01:00) Warsaw
(UTC+01:00) West Central Africa
(UTC+01:00) Zagreb
(UTC+02:00) Athens
(UTC+02:00) Bucharest
(UTC+02:00) Cairo
(UTC+02:00) Harare
(UTC+02:00) Helsinki
(UTC+02:00) Istanbul
(UTC+02:00) Jerusalem
(UTC+02:00) Kyiv
(UTC+02:00) Pretoria
(UTC+02:00) Riga
(UTC+02:00) Sofia
(UTC+02:00) Tallinn
(UTC+02:00) Vilnius
(UTC+03:00) Baghdad
(UTC+03:00) Kuwait
(UTC+03:00) Minsk
(UTC+03:00) Nairobi
(UTC+03:00) Riyadh
(UTC+03:00) Volgograd
(UTC+03:30) Tehran
(UTC+04:00) Abu Dhabi
(UTC+04:00) Baku
(UTC+04:00) Moscow
(UTC+04:00) Muscat
(UTC+04:00) St. Petersburg
(UTC+04:00) Tbilisi
(UTC+04:00) Yerevan
(UTC+04:30) Kabul
(UTC+05:00) Islamabad
(UTC+05:00) Karachi
(UTC+05:00) Tashkent
(UTC+05:30) Chennai
(UTC+05:30) Kolkata
(UTC+05:30) Mumbai
(UTC+05:30) New Delhi
(UTC+05:30) Sri Jayawardenepura
(UTC+05:45) Kathmandu
(UTC+06:00) Almaty
(UTC+06:00) Astana
(UTC+06:00) Dhaka
(UTC+06:00) Ekaterinburg
(UTC+06:30) Rangoon
(UTC+07:00) Bangkok
(UTC+07:00) Hanoi
(UTC+07:00) Jakarta
(UTC+07:00) Novosibirsk
(UTC+08:00) Beijing
(UTC+08:00) Chongqing
(UTC+08:00) Hong Kong
(UTC+08:00) Krasnoyarsk
(UTC+08:00) Kuala Lumpur
(UTC+08:00) Perth
(UTC+08:00) Singapore
(UTC+08:00) Taipei
(UTC+08:00) Ulaan Bataar
(UTC+08:00) Urumqi
(UTC+09:00) Irkutsk
(UTC+09:00) Osaka
(UTC+09:00) Sapporo
(UTC+09:00) Seoul
(UTC+09:00) Tokyo
(UTC+09:30) Adelaide
(UTC+09:30) Darwin
(UTC+10:00) Brisbane
(UTC+10:00) Canberra
(UTC+10:00) Guam
(UTC+10:00) Hobart
(UTC+10:00) Melbourne
(UTC+10:00) Port Moresby
(UTC+10:00) Sydney
(UTC+10:00) Yakutsk
(UTC+11:00) Vladivostok
(UTC+12:00) Auckland
(UTC+12:00) Fiji
(UTC+12:00) International Date Line West
(UTC+12:00) Kamchatka
(UTC+12:00) Magadan
(UTC+12:00) Marshall Is.
(UTC+12:00) New Caledonia
(UTC+12:00) Solomon Is.
(UTC+12:00) Wellington
(UTC+13:00) Nuku'alofa

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 55.2% 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

Unknown

Total

1

Last Release

1007d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/55b0ae5776f3c8ad9b3dd879b395a5b3b278956b74068a77327e48fe002c7e50?d=identicon)[ionutrusen](/maintainers/ionutrusen)

---

Top Contributors

[![camroncade](https://avatars.githubusercontent.com/u/5819714?v=4)](https://github.com/camroncade "camroncade (16 commits)")[![IonutRusen](https://avatars.githubusercontent.com/u/15908431?v=4)](https://github.com/IonutRusen "IonutRusen (7 commits)")[![kyranb](https://avatars.githubusercontent.com/u/5426926?v=4)](https://github.com/kyranb "kyranb (3 commits)")[![davidavz](https://avatars.githubusercontent.com/u/6774576?v=4)](https://github.com/davidavz "davidavz (1 commits)")[![iconjenchua](https://avatars.githubusercontent.com/u/9497419?v=4)](https://github.com/iconjenchua "iconjenchua (1 commits)")[![vasyahuyasa](https://avatars.githubusercontent.com/u/10506304?v=4)](https://github.com/vasyahuyasa "vasyahuyasa (1 commits)")

---

Tags

timezonestimezone

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[camroncade/timezone

Helps manage timezones in Laravel. Includes &lt;select&gt; form builder for timezones.

162982.4k7](/packages/camroncade-timezone)[glhd/laravel-timezone-mapper

Timezone mapper for Laravel

45284.4k](/packages/glhd-laravel-timezone-mapper)[juanparati/iso-codes

A PHP library that provides ISO codes, currencies, languages, timezones and additional geopolitical information

17146.4k](/packages/juanparati-iso-codes)[joy2362/php-time-zone

A simple package that provide list of all timezone that php support

162.0k](/packages/joy2362-php-time-zone)

PHPackages © 2026

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