from-unixtime

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

from-unixtime [2015/11/10 10:42] (current)
dmtolpeko created
Line 1: Line 1:
 +====== FROM_UNIXTIME Function ======
  
 +FROM_UNIXTIME function converts the specified number of seconds since 1970-01-01 00:00:00 to timestamp value.
 +
 +**Syntax**:
 +
 +<code language="​sql">​
 +FROM_UNIXTIME(epoch,​ [format])
 +</​code>​
 +
 +**Parameters**:​
 +  * //epoch// is the number of seconds since 1970-01-01 00:00:00
 +  * //format// is the timestamp format, optional. The default format is yyyy-MM-dd HH:mm:ss
 +
 +**Return Type:**
 +
 +STRING
 +
 +**Example**:​
 +
 +Convert the number of seconds to timestamp value:
 +
 +<code language="​sql">​
 +from_unixtime(1447141681);​
 +---
 +2015-11-10 04:48:01
 +
 +from_unixtime(1447141681,​ '​yyyy-MM-dd'​);​
 +---
 +2015-11-10
 +</​code> ​
 +
 +**Compatibility**:​ Hive.
 +
 +**Version:​** HPL/SQL 0.3.17
 +
 +See also:
 +
 +  * [[current-date|CURRENT_DATE]]
 +  * [[current-timestamp|CURRENT_TIMESTAMP]]
 +  * [[now|NOW]]
 +  * [[sysdate|SYSDATE]]
 +  * [[unix-timestamp|UNIX_TIMESTAMP]]