extract the date from a timestamp value variable in Impala

Anna  picture Anna · Jun 24, 2018 · Viewed 9.5k times · Source

How can I extract the date from a timestamp value variable in Impala?

eg time = 2018-04-11 16:05:19 should be 2018-04-11

Answer

hidsan picture hidsan · Jun 24, 2020

try this:

from_timestamp('2018-04-11 16:05:19','yyyy-MM-dd') as date_value

from_timestamp(datetime timestamp, pattern string): Converts a TIMESTAMP value into a string representing the same value. Please see documentation here