Parsing dates and datetimes in ClickHouse

Mark Needham

Parsing dates and datetimes is one of those things you'll do constantly in ClickHouse, and there are actually quite a few different approaches depending on your data format. In this tutorial, we walk through five practical methods for handling everything from Unix timestamps to messy string formats that you might get from APIs or legacy systems.

  • Converting Unix timestamps (seconds, milliseconds, and microseconds)
  • Parsing numeric date formats from legacy databases and mainframes
  • Handling datetime strings with known formats using MySQL and JODA syntax
  • Using "best effort" parsing for inconsistent or unknown date formats
  • Configuring session-level settings for automatic type casting can we make this to htnml