Class: Lafcadio::DateTimeField
- Inherits:
-
ObjectField
- Object
- ObjectField
- Lafcadio::DateTimeField
- Defined in:
- lib/lafcadio/objectField/DateTimeField.rb
Overview
DateTimeField represents a DateTime.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from ObjectField
#dbFieldName, #default, #defaultFieldName, #hideDisplay, #hideLabel, #name, #notNull, #notUniqueMsg, #objectType, #unique, #writeOnce
Instance Method Summary collapse
Methods inherited from ObjectField
#<=>, #bind_write?, #dbWillAutomaticallyWrite, #db_table_and_field_name, #englishName, #firstTime, #initialize, instantiateFromXml, instantiateWithParameters, instantiationParameters, #nameForSQL, #nullErrorMsg, #prevValue, #processBeforeVerify, valueType, #verify, #verifyUniqueness
Constructor Details
This class inherits a constructor from Lafcadio::ObjectField
Instance Method Details
#valueForSQL(value) ⇒ Object
:nodoc:
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/lafcadio/objectField/DateTimeField.rb', line 11 def valueForSQL(value) # :nodoc: if value year = value.year month = value.mon.to_s.pad( 2, "0" ) day = value.day.to_s.pad( 2, "0" ) hour = value.hour.to_s.pad( 2, "0" ) minute = value.min.to_s.pad( 2, "0" ) second = value.sec.to_s.pad( 2, "0" ) "'#{year}-#{month}-#{day} #{hour}:#{minute}:#{second}'" else "null" end end |
#valueFromSQL(dbi_value, lookupLink = true) ⇒ Object
:nodoc:
7 8 9 |
# File 'lib/lafcadio/objectField/DateTimeField.rb', line 7 def valueFromSQL(dbi_value, lookupLink = true) # :nodoc: dbi_value ? dbi_value.to_time : nil end |