Thursday 24 November 2022

Hive: unix_timestamp: Get number of seconds from Unix Epoch

Signature

unix_timestamp()
unix_timestamp( string date )
unix_timestamp( string date, string pattern )

hive> SELECT unix_timestamp();
unix_timestamp(void) is deprecated. Use current_timestamp instead.
OK
_c0
1649767043
Time taken: 0.06 seconds, Fetched: 1 row(s)
hive> ;
hive> ;
hive> SELECT unix_timestamp('2022-01-01 00:00:00');
OK
_c0
1641024000
Time taken: 0.054 seconds, Fetched: 1 row(s)
hive> ;
hive> ;
hive> SELECT unix_timestamp('2022-01-01', 'yyyy-MM-dd');
OK
_c0
1641024000
Time taken: 0.04 seconds, Fetched: 1 row(s)

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment