diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-07-16 13:00:36 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-07-16 13:01:23 +0100 |
commit | 0432d151647f2178ddee79979827d552447c251f (patch) | |
tree | 7c772cd260eb051cd7b80cf91468555f03db9e11 /activesupport/lib/active_support/time_with_zone.rb | |
parent | f7d08acd5e0650658383e3d3f86d6ff5b49e9030 (diff) | |
download | rails-0432d151647f2178ddee79979827d552447c251f.tar.gz rails-0432d151647f2178ddee79979827d552447c251f.tar.bz2 rails-0432d151647f2178ddee79979827d552447c251f.zip |
Merge with docrails.
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index e85bfe9b2e..4866fa0dc8 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -102,7 +102,19 @@ module ActiveSupport "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{formatted_offset(true, 'Z')}" end alias_method :iso8601, :xmlschema - + + # Returns a JSON string representing the TimeWithZone. If ActiveSupport.use_standard_json_time_format is set to + # true, the ISO 8601 format is used. + # + # ==== Examples: + # + # # With ActiveSupport.use_standard_json_time_format = true + # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json + # # => "2005-02-01T15:15:10Z" + # + # # With ActiveSupport.use_standard_json_time_format = false + # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json + # # => "2005/02/01 15:15:10 +0000" def to_json(options = nil) if ActiveSupport.use_standard_json_time_format xmlschema.inspect |