Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In Impala, you can convert a string into a date using the CAST() function.

The syntax for converting a string into a date is:

CAST(string_expression AS DATE)

For example, if you have a string column "dob" that contains dates in a "YYYY-MM-DD" format, you can convert it into a date column using the following query:

SELECT CAST(dob AS DATE) AS birth_date
FROM my_table;

This will create a new column named "birth_date" which will contain the date values.

Note: The stringexpression should be in the format accepted by the DATE type in Impala, which is "YYYY-MM-DD". If your string format is different, you may need to use the DATEFORMAT function to specify the source format of the string.