root/trunk/activesupport/lib/active_support/json/encoders/date_time.rb
| Revision 9203, 355 bytes (checked in by rick, 6 months ago) |
|---|
| Line | |
|---|---|
| 1 | class DateTime |
| 2 | # Returns a JSON string representing the datetime. |
| 3 | # |
| 4 | # ==== Example: |
| 5 | # DateTime.civil(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 | xmlschema.inspect |
| 10 | else |
| 11 | %("#{strftime("%Y/%m/%d %H:%M:%S %z")}") |
| 12 | end |
| 13 | end |
| 14 | end |
Note: See TracBrowser for help on using the browser.