Adds #strptime method to ActiveSupport::TimeZone
Latest commit 46a622b Aug 30, 2016 @doz committed on GitHub Merge pull request #6 from princejoseph/feature/daylight-saving-period
Feature/daylight saving period
Failed to load latest commit information.
.travis.yml Changing travis config to run against newer ruby versions. Aug 29, 2016 Release v.0.0.3 Aug 20, 2012
Gemfile Rename to TimeZoneExt Jun 27, 2012
LICENSE Fix 1.8 compatibility, add TravisCI badge Jun 28, 2012

TimeZoneExt Build Status

ActiveSupport::TimeZone class defines almost every method you need to handle time. Thus providing you with convenient means (,, etc.) to get time in current time zone.

When you get time string from an external service and parse can't handle it you need to use strptime method. But ActiveSupport doesn't define strptime method. Let's add this method that will do timezone magic for you.


Add this line to your application's Gemfile:

gem 'time_zone_ext'

And then execute:

$ bundle

Or install it yourself as:

$ gem install time_zone_ext


If you parse time string that already includes timezone information will return this time in current timezone. = 'EST'"2012-06-02 00:00 UTC", "%Y-%m-%d %H:%M %Z")
# => Fri, 01 Jun 2012 19:00:00 EST -05:00

If you parse string without explicitly specified timezone, it will be treated as defined in current timezone. = 'EST'"2012-06-02 00:00", "%Y-%m-%d %H:%M")
# => Sat, 02 Jun 2012 00:00:00 EST -05:00


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request


Copyright (c) 2012 Alexander Danilenko. See LICENSE.txt for further details.