| Class | AWS::Record::Attributes::DateAttr |
| In: |
lib/aws/record/attributes.rb
|
| Parent: | BaseAttr |
Returns a Date object encoded as a string (suitable for sorting).
attribute.serialize(DateTime.parse('2001-01-01'))
#=> '2001-01-01'
@param [Date] datetime The date to serialize.
@param [Hash] options
@return [String] Returns the date object serialized to a string
('YYYY-MM-DD').
Returns value cast to a Date object. Empty strings are cast to nil. Values are cast first to strings and then passed to Date.parse. Integers are treated as timestamps.
date_attribute.type_cast('2000-01-02T10:11:12Z')
#=> #<Date: 4903091/2,0,2299161>
date_attribute.type_cast(1306170146)
#<Date: 4911409/2,0,2299161>
date_attribute.type_cast('')
#=> nil
date_attribute.type_cast(nil)
#=> nil
@param [Mixed] raw_value The value to cast to a Date object. @param [Hash] options @return [Date,nil]