Hive UDF String to Date Convertion Hive UDF String to Date Convertion hadoop hadoop

Hive UDF String to Date Convertion


Your problem is that HiveQL is generally case insensitive, but the second argument of the unix_timestamp function, instead, is case sensitive. Thus the right syntax for your query is:

select TO_DATE(from_unixtime(UNIX_TIMESTAMP(date,'dd-MM-yyyy'))) from sample;

In this way, you'll get the expected result.


Simply a typo, the pattern should be dd-MM-yyyy.