Class: DBI::DBD::Jdbc::Type::Timestamp
- Inherits:
-
Type::Null
- Object
- Type::Null
- DBI::DBD::Jdbc::Type::Timestamp
- Defined in:
- lib/dbd/Jdbc.rb
Class Method Summary collapse
Class Method Details
.parse(obj) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/dbd/Jdbc.rb', line 71 def self.parse(obj) obj = super return obj unless obj if obj.kind_of?(::DateTime) || obj.kind_of?(::Time) || obj.kind_of?(::Date) return obj elsif obj.kind_of?(::String) return ::DateTime.strptime(obj, "%Y-%m-%d %H:%M:%S") else return ::DateTime.parse(obj.to_s) if obj.respond_to? :to_s return ::DateTime.parse(obj.to_str) if obj.respond_to? :to_str return obj end end |