| | 26 | # Convert to a formatted string - see DATE_FORMATS for predefined formats. |
|---|
| | 27 | # You can also add your own formats to the DATE_FORMATS constant and use them with this method. |
|---|
| | 28 | # |
|---|
| | 29 | # This method is also aliased as <tt>to_s</tt>. |
|---|
| | 30 | # |
|---|
| | 31 | # ==== Examples: |
|---|
| | 32 | # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 |
|---|
| | 33 | # |
|---|
| | 34 | # date.to_formatted_s(:db) # => "2007-11-10" |
|---|
| | 35 | # date.to_s(:db) # => "2007-11-10" |
|---|
| | 36 | # |
|---|
| | 37 | # date.to_formatted_s(:short) # => "10 Nov" |
|---|
| | 38 | # date.to_formatted_s(:long) # => "November 10, 2007" |
|---|
| | 39 | # date.to_formatted_s(:long_ordinal) # => "November 10th, 2007" |
|---|
| | 40 | # date.to_formatted_s(:rfc822) # => "10 Nov 2007" |
|---|
| 48 | | # Converts self to a Ruby Time object; time is set to beginning of day |
|---|
| 49 | | # Timezone can either be :local or :utc (default :local) |
|---|
| | 64 | # Converts a Date instance to a Time, where the time is set to the beginning of the day. |
|---|
| | 65 | # The timezone can be either :local or :utc (default :local). |
|---|
| | 66 | # |
|---|
| | 67 | # ==== Examples: |
|---|
| | 68 | # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 |
|---|
| | 69 | # |
|---|
| | 70 | # date.to_time # => Sat Nov 10 00:00:00 0800 2007 |
|---|
| | 71 | # date.to_time(:local) # => Sat Nov 10 00:00:00 0800 2007 |
|---|
| | 72 | # |
|---|
| | 73 | # date.to_time(:utc) # => Sat Nov 10 00:00:00 UTC 2007 |
|---|