Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extract the date from a timestamp value variable in Impala

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

like image 277
Anna Avatar asked Jun 24 '18 20:06

Anna


2 Answers

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

like image 175
hidsan Avatar answered Oct 04 '22 01:10

hidsan


to_date (t1.local_time), as date_value

to_date: Returns a string representation of the date field from a timestamp value.

like image 24
Anna Avatar answered Oct 04 '22 03:10

Anna