Clickhouse: Parse DateTime consistently

Created on 12 Jan 2019  Â·  2Comments  Â·  Source: ClickHouse/ClickHouse

Inserting string formatted datetime with subsecond and/or with time zone is working as expected with date_time_input_format setting set to best_effort (as tested with this sql). But

SELECT toDateTime('2018-06-08T01:02:03.000Z')

gives error:

Code: 6. DB::Exception: Received from localhost:9000, ::1. DB::Exception: Cannot parse string '2018-06-08T01:02:03.000Z' as DateTime: syntax error at position 19 (parsed just '2018-06-08T01:02:03'). 

I think both datetime parsing should behave the same so if INSERT can parse toDateTime should also parse the same string.

I am testing with docker image yandex/clickhouse-server:18.16.1

Most helpful comment

Are you aware of parseDateTimeBestEffort ?

select * from system.functions where name like '%Best%'

SELECT parseDateTimeBestEffort('2018-06-08T01:02:03.000Z')

All 2 comments

Are you aware of parseDateTimeBestEffort ?

select * from system.functions where name like '%Best%'

SELECT parseDateTimeBestEffort('2018-06-08T01:02:03.000Z')

Great news, i couldnt find that function :man_facepalming: . Closing issue.

Was this page helpful?
0 / 5 - 0 ratings