Class: Jabara::MySQL::Schema::DateTime
- Inherits:
-
Object
- Object
- Jabara::MySQL::Schema::DateTime
- Defined in:
- lib/jabara/mysql/schema.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.tag ⇒ Object
84 85 86 |
# File 'lib/jabara/mysql/schema.rb', line 84 def self.tag :datetime end |
Instance Method Details
#parse(data) ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/jabara/mysql/schema.rb', line 88 def parse(data) raise ArgumentError, 'must be string' unless data.is_a? ::String begin DateTime.strptime(date, '%Y-%m-%d %H:%M:%S.%N') rescue ArgumentError DateTime.strptime(date, '%Y-%m-%d %H:%M:%S') # may raise ArgumentError end end |