
# from_unixtime
from_unixtime函数用于计算将数字型的UNIX值代表的时间戳转换为日期值。
#### 命令格式
```
from_unixtime(bigint unixtime)
```
#### 参数说明
表1参数说明 
| 参数       | 是否必选 | 参数类型   | 说明                                                                                                                 |
|:---|:---|:---|:---|
| unixtime | 是    | BIGINT | UNIX格式的时间戳。代表需要转换的时间戳 此处参数应填正常UNIX格式时间戳前十位。 |
   
#### 返回值说明
将时间戳转换为时间格式，返回STRING类型的日期值，格式为"yyyy-MM-dd HH:mm:ss"或"yyyyMMddHHmmss.uuuuuu"或 "yyyyMMdd"。
![](https://support.huaweicloud.com/sqlref-spark-dli/public_sys-resources/note_3.0-zh-cn.png)
unixtime值为NULL时，返回NULL。
#### 示例代码
返回2023-08-16 09:39:57。
```
select from_unixtime(1692149997);
```
返回NULL。
```
select from_unixtime(NULL);
```
表数据示例
```
select unixdate, from_unixtime(unixdate) as timestamp_from_unixtime from database_t;
输出：
+------------------+------------------------------+
| unixdate              | timestamp_from_unixtime   |
+------------------+------------------------------+
| 1690944759224  | 2023-08-02 10:52:39           |
| 1690944999811  | 2023-08-02 10:56:39           |
| 1690945005458  | 2023-08-02 10:56:45           |
| 1690945011542  | 2023-08-02 10:56:51           |
| 1690945023151  | 2023-08-02 10:57:03           |
+------------------+------------------------------+
```
