Class: ClickHouse::Type::DateTimeType

Inherits:
BaseType
  • Object
show all
Defined in:
lib/click_house/type/date_time_type.rb

Instance Method Summary collapse

Instance Method Details

#cast(value, tz = nil) ⇒ Object


6
7
8
# File 'lib/click_house/type/date_time_type.rb', line 6

def cast(value, tz = nil)
  DateTime.parse("#{value} #{tz}")
end

#serialize(value) ⇒ Object


10
11
12
# File 'lib/click_house/type/date_time_type.rb', line 10

def serialize(value)
  value.strftime('%Y-%m-%d %H:%M:%S')
end