Search code examples
hadoophiveooziebeeline

Hive Current date function


I want to get the current date in beeline.

I tried to use this:

FROM_UNIXTIME(UNIX_TIMESTAMP())

it outputs this:

16-03-21

What I was looking to get it:

2016-03-21 09:34

How do I do it? I see the beeline documentation here: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions

But it didnt work for me.


Solution

  • Try this:

     Select to_date(from_unixtime(unix_timestamp())) from my table ...
    

    Results in '2016-03-21'