Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8428

Show
Ignore:
Timestamp:
12/17/07 00:18:27 (10 months ago)
Author:
david
Message:

Docfix (closes #10369) [revans]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/lib/active_support/core_ext/date_time/conversions.rb

    r8398 r8428  
    1616          end 
    1717        end 
    18  
     18         
     19        # Convert to a formatted string - see DATE_FORMATS for predefined formats. 
     20        # You can also add your own formats to the DATE_FORMATS constant and use them with this method. 
     21        #  
     22        # This method is also aliased as <tt>to_s</tt>. 
     23        #  
     24        # === Examples: 
     25        #   datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0)   # => Tue, 04 Dec 2007 00:00:00 +0000 
     26        #  
     27        #   datetime.to_formatted_s(:db)            # => "2007-12-04 00:00:00" 
     28        #   datetime.to_s(:db)                      # => "2007-12-04 00:00:00" 
     29        #   datetime.to_s(:number)                  # => "20071204000000" 
     30        #   datetime.to_formatted_s(:short)         # => "04 Dec 00:00" 
     31        #   datetime.to_formatted_s(:long)          # => "December 04, 2007 00:00" 
     32        #   datetime.to_formatted_s(:long_ordinal)  # => "December 4th, 2007 00:00" 
     33        #   datetime.to_formatted_s(:rfc822)        # => "Tue, 04 Dec 2007 00:00:00 +0000" 
    1934        def to_formatted_s(format = :default) 
    2035          if formatter = ::Time::DATE_FORMATS[format] 
     
    5065        end 
    5166 
     67        # Converts datetime to an appropriate format for use in XML 
    5268        def xmlschema 
    5369          strftime("%Y-%m-%dT%H:%M:%S%Z")