Socket
Book a DemoInstallSign in
Socket

to_timezone

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to_timezone

0.3.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

ToTimezone

Easily convert Time and DateTime objects to different time zones using intuitive methods like .to_pht, .to_ict, and more.

Installation

Add this line to your application's Gemfile:

gem 'to_timezone'

Then execute:

bundle install

Or install it yourself as:

gem install to_timezone

Usage

This gem allows you to call methods like to_utc, to_pht, and others to convert Time and DateTime objects to different time zones.

Example:

# Current time in your local timezone
current_time = Time.now

# Convert to a specific timezone (e.g., Manila)
manila_time = current_time.to_pht  # => Asia/Manila time zone

puts manila_time # => 2025-02-07 10:53:47.355858000 PST +08:00

or with Strings:

pht = "2014-07-05 14:30:00".to_ph
puts pht # => 2014-07-05 14:30:00 +08:00

Supported Timezones:

MethodTimezone Name
to_idlwEtc/GMT+12
to_utcEtc/UTC
to_mitPacific/Midway
to_sst_samPacific/Apia
to_sstPacific/Pago_Pago
to_hstPacific/Honolulu
to_akstAmerica/Juneau
to_pstAmerica/Los_Angeles
to_pst_tjAmerica/Tijuana
to_mstAmerica/Denver
to_mst_azAmerica/Phoenix
to_cstAmerica/Chicago
to_cst_skAmerica/Regina
to_cst_gdlAmerica/Mexico_City
to_cst_mtAmerica/Monterrey
to_cst_caAmerica/Guatemala
to_estAmerica/New_York
to_est_inAmerica/Indiana/Indianapolis
to_est_bgAmerica/Bogota
to_est_lmAmerica/Lima
to_astAmerica/Halifax
to_ast_prAmerica/Puerto_Rico
to_vetAmerica/Caracas
to_botAmerica/La_Paz
to_cltAmerica/Santiago
to_nstAmerica/St_Johns
to_brtAmerica/Sao_Paulo
to_artAmerica/Argentina/Buenos_Aires
to_uytAmerica/Montevideo
to_gytAmerica/Guyana
to_wgtAmerica/Godthab
to_miaAtlantic/South_Georgia
to_aztAtlantic/Azores
to_cvtAtlantic/Cape_Verde
to_gmtEurope/Dublin
to_gmt_lonEurope/London
to_wetEurope/Lisbon
to_cetAfrica/Casablanca
to_gmt_lbrAfrica/Monrovia
to_cet_bgEurope/Belgrade
to_cet_bsEurope/Bratislava
to_cet_bdEurope/Budapest
to_cet_ljEurope/Ljubljana
to_cet_pgEurope/Prague
to_cet_svEurope/Sarajevo
to_cet_skEurope/Skopje
to_cet_wzEurope/Warsaw
to_cet_zgEurope/Zagreb
to_cet_brusselsEurope/Brussels
to_cet_cpEurope/Copenhagen
to_cet_mdEurope/Madrid
to_cet_prEurope/Paris
to_cet_amEurope/Amsterdam
to_cet_br2Europe/Berlin
to_cet_zrEurope/Zurich
to_cet_roEurope/Rome
to_cet_stEurope/Stockholm
to_cet_vnEurope/Vienna
to_cet_waAfrica/Algiers
to_eetEurope/Bucharest
to_eet_caiAfrica/Cairo
to_eet_hlsEurope/Helsinki
to_eet_kvEurope/Kiev
to_eet_riEurope/Riga
to_eet_sfEurope/Sofia
to_eet_tlEurope/Tallinn
to_eet_viEurope/Vilnius
to_eet_atEurope/Athens
to_eet_isEurope/Istanbul
to_fetEurope/Minsk
to_idtAsia/Jerusalem
to_catAfrica/Harare
to_sastAfrica/Johannesburg
to_usz1Europe/Kaliningrad
to_mskEurope/Moscow
to_vlgEurope/Volgograd
to_samEurope/Samara
to_ast_kwAsia/Kuwait
to_ast_ryAsia/Riyadh
to_eatAfrica/Nairobi
to_ast_bdAsia/Baghdad
to_irstAsia/Tehran
to_gstAsia/Muscat
to_azt_bakuAsia/Baku
to_getAsia/Tbilisi
to_amtAsia/Yerevan
to_aftAsia/Kabul
to_yektAsia/Yekaterinburg
to_pktAsia/Karachi
to_uztAsia/Tashkent
to_istAsia/Kolkata
to_nptAsia/Kathmandu
to_bstAsia/Dhaka
to_lktAsia/Colombo
to_almtAsia/Almaty
to_novtAsia/Novosibirsk
to_burmAsia/Rangoon
to_ictAsia/Bangkok
to_wibAsia/Jakarta
to_kratAsia/Krasnoyarsk
to_cst_cnAsia/Shanghai
to_hktAsia/Hong_Kong
to_xinAsia/Urumqi
to_mytAsia/Kuala_Lumpur
to_sgtAsia/Singapore
to_cst_tpeAsia/Taipei
to_awstAustralia/Perth
to_irktAsia/Irkutsk
to_ulatAsia/Ulaanbaatar
to_kstAsia/Seoul
to_jstAsia/Tokyo
to_yaktAsia/Yakutsk
to_acstAustralia/Darwin
to_acdtAustralia/Adelaide
to_aedtAustralia/Canberra
to_aestAustralia/Melbourne
to_aest_sydAustralia/Sydney
to_aest_bneAustralia/Brisbane
to_aetAustralia/Hobart
to_phtAsia/Manila

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/to_timezone. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the ToTimezone project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 19 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.