Skip to content

@jwoertink /gist:5035116
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# Need a method that takes a date and based on a given time zone gives me the correct offset
# with daylight savings time into consideration
Time.zone = "Pacific US and Canada"
Time.some_method_name("2013-03-09") #=> "PST -0800"
Time.some_method_name("2013-03-10") #=> "PDT -0700"
#############
ActiveSupport::TimeZone.all.sort_by(&:name).each_with_index do |timezone, index|
# Need this to be "-0700 Pcific Time (US & Canada) if a specified date is after DST
"#{timezone.formatted_offset(false)} #{timezone.name}" # => "-0800 Pacific Time (US & Canada)"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.