Flowdock
method

formatted_offset

Importance_1
Ruby on Rails latest stable (v4.0.2) - 0 notes - Class: ActiveSupport::TimeWithZone
formatted_offset(colon = true, alternate_utc_string = nil) public

Returns a formatted string of the offset from UTC, or an alternative string if the time zone is already UTC.

Time.zone = 'Eastern Time (US & Canada)'   # => "Eastern Time (US & Canada)"
Time.zone.now.formatted_offset(true)       # => "-05:00"
Time.zone.now.formatted_offset(false)      # => "-0500"
Time.zone = 'UTC'                          # => "UTC"
Time.zone.now.formatted_offset(true, "0")  # => "0"
Show source
Register or log in to add new notes.