Class

TimeZone

Extends:

Includes:

There's no documentation for this item.

Constants
MAPPING
US_ZONES A regular expression that matches the names of all time zones in the USA.
Public Attributes
name
utc_offset
Public Methods
<=> Compare this time zone to the parameter. The two are comapred first on their offsets, and then by name.
[] Locate a specific time zone object. If the argument is a string, it is interpreted to mean the name of the timezone to locate. If it is a numeric value it is either the hour offset, or the second offset, of the timezone to find. (The first one with that offset will be returned.) Returns nil if no such time zone is known to the system.
all Return an array of all TimeZone objects. There are multiple TimeZone objects per time zone, in many cases, to make it easier for users to find their own time zone.
create Alias for #new
formatted_offset Returns the offset of this time zone as a formatted string, of the format "+HH:MM".
local_to_utc Adjust the given time to the simultaneous time in UTC. Returns a Time.utc() instance.
new Create a new TimeZone object with the given name and offset. The offset is the number of seconds that this time zone is offset from UTC (GMT). Seconds were chosen as the offset unit because that is the unit that Ruby uses to represent time zone offsets (see Time#utc_offset).
new Return a TimeZone instance with the given name, or nil if no such TimeZone instance exists. (This exists to support the use of this class with the #composed_of macro.)
new Method for creating new ActiveSupport::TimeWithZone instance in time zone of self. Example:
now Returns an ActiveSupport::TimeWithZone instance representing the current time in the time zone represented by self. Example:
period_for_local Available so that TimeZone instances respond like TZInfo::Timezone instances
to_s Returns a textual representation of this time zone.
today Return the current date in this time zone.
tzinfo
us_zones A convenience method for returning a collection of TimeZone objects for time zones in the USA.
utc_to_local Adjust the given time to the simultaneous time in the time zone represented by self. Returns a Time.utc() instance — if you want an ActiveSupport::TimeWithZone instance, use Time#in_time_zone() instead.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.