Class: ClickHouse::Type::DateTimeType
- Inherits:
-
BaseType
- Object
- BaseType
- ClickHouse::Type::DateTimeType
show all
- Defined in:
- lib/click_house/type/date_time_type.rb
Constant Summary
collapse
- FORMAT =
'%Y-%m-%d %H:%M:%S'
Instance Method Summary
collapse
Methods inherited from BaseType
#cast_each, #container?, #ddl?, #map?, #serialize_each, #tuple?
Instance Method Details
#cast(value, tz = nil) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/click_house/type/date_time_type.rb', line 8
def cast(value, tz = nil)
if tz
Time.find_zone(tz).strptime(value, FORMAT)
else
Time.strptime(value, FORMAT)
end
end
|
#serialize(value) ⇒ Object
16
17
18
|
# File 'lib/click_house/type/date_time_type.rb', line 16
def serialize(value, *)
value.strftime(FORMAT)
end
|