root/trunk/activesupport/lib/active_support/json/encoders/time.rb
| Revision 9203, 368 bytes (checked in by rick, 5 months ago) |
|---|
| Line | |
|---|---|
| 1 | class Time |
| 2 | # Returns a JSON string representing the time. |
| 3 | # |
| 4 | # ==== Example: |
| 5 | # Time.utc(2005,2,1,15,15,10).to_json |
| 6 | # # => 2005/02/01 15:15:10 +0000" |
| 7 | def to_json(options = nil) |
| 8 | if ActiveSupport.use_standard_json_time_format |
| 9 | utc.xmlschema.inspect |
| 10 | else |
| 11 | %("#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}") |
| 12 | end |
| 13 | end |
| 14 | end |
Note: See TracBrowser for help on using the browser.