Class: Time
- Includes:
- ActiveSupport::CoreExtensions::Time::Behavior, ActiveSupport::CoreExtensions::Time::Calculations, ActiveSupport::CoreExtensions::Time::Conversions, ActiveSupport::CoreExtensions::Time::Zones
- Defined in:
- lib/active_support/core_ext/time.rb,
lib/active_support/core_ext/time.rb,
lib/active_support/json/encoders/time.rb
Overview
:nodoc:
Constant Summary
Constants included from ActiveSupport::CoreExtensions::Time::Conversions
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS
Constants included from ActiveSupport::CoreExtensions::Time::Calculations
ActiveSupport::CoreExtensions::Time::Calculations::COMMON_YEAR_DAYS_IN_MONTH
Instance Method Summary collapse
-
#to_json(options = nil) ⇒ Object
Returns a JSON string representing the time.
Methods included from ActiveSupport::CoreExtensions::Time::Zones
Methods included from ActiveSupport::CoreExtensions::Time::Conversions
#formatted_offset, included, #to_date, #to_datetime, #to_formatted_s, #to_time
Methods included from ActiveSupport::CoreExtensions::Time::Calculations
#advance, #ago, #beginning_of_day, #beginning_of_month, #beginning_of_quarter, #beginning_of_week, #beginning_of_year, #change, #compare_with_coercion, #end_of_day, #end_of_month, #end_of_quarter, #end_of_week, #end_of_year, included, #last_month, #last_year, #minus_with_coercion, #minus_with_duration, #months_ago, #months_since, #next_month, #next_week, #next_year, #plus_with_duration, #seconds_since_midnight, #since, #tomorrow, #years_ago, #years_since, #yesterday
Methods included from ActiveSupport::CoreExtensions::Time::Behavior
Instance Method Details
#to_json(options = nil) ⇒ Object
Returns a JSON string representing the time.
Example:
Time.utc(2005,2,1,15,15,10).to_json
# => 2005/02/01 15:15:10 +0000"
7 8 9 10 11 12 13 |
# File 'lib/active_support/json/encoders/time.rb', line 7 def to_json( = nil) if ActiveSupport.use_standard_json_time_format xmlschema.inspect else %("#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}") end end |