Class | AWS::Record::Attributes::DateTimeAttr |
In: |
lib/aws/record/attributes.rb
|
Parent: | BaseAttr |
Returns a DateTime object encoded as a string (suitable for sorting).
attribute.serialize(DateTime.parse('2001-01-01')) #=> '2001-01-01T00:00:00:Z)
@param [DateTime] datetime The datetime object to serialize. @param [Hash] options @return [String] Returns the datetime object serialized to a string
in ISO8601 format (e.g. '2011-01-02T10:11:12Z')
Returns value cast to a DateTime object. Empty strings are cast to nil. Values are cast first to strings and then passed to DateTime.parse. Integers are treated as timestamps.
datetime_attribute.type_cast('2000-01-02') #=> #<DateTime: 4903091/2,0,2299161> datetime_attribute.type_cast(1306170146) #<DateTime: 106086465073/43200,-7/24,2299161> datetime_attribute.type_cast('') #=> nil datetime_attribute.type_cast(nil) #=> nil
@param [Mixed] raw_value The value to cast to a DateTime object. @param [Hash] options @return [DateTime,nil]