How to select current date in Hive SQL

后端 未结 6 832
谎友^
谎友^ 2020-12-24 00:11

How do we get the current system date in Hive? In MySQL we have select now(), can any one please help me to get the query results. I am very new to Hive, is there a proper d

6条回答
  •  盖世英雄少女心
    2020-12-24 00:58

    To fetch only current date excluding time stamp:

    in lower versions, looks like hive CURRENT_DATE is not available, hence you can use (it worked for me on Hive 0.14)

    select TO_DATE(FROM_UNIXTIME(UNIX_TIMESTAMP()));
    

    In higher versions say hive 2.0, you can use :

    select CURRENT_DATE;
    

提交回复
热议问题