SELECT from_unixtime(unix_timestamp(CAST(date_var AS string) ,'yyyyMMdd'), 'yyyy-MM-dd') AS min_unix_date