

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 类型转换函数
<a name="sql-functions-type-conv"></a>

 类型转换函数用于将值的数据类型从一种更改为另一种值。它们对于确保数据兼容性和执行需要特定格式数据的操作至关重要。


|  **函数**  |  **签名**  |  **描述**  | 
| --- | --- | --- | 
|  `TO_DATE`  |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  | 
|  `TO_TIMESTAMP`  |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  | 
|  `TO_TIME`  |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  | 
|  `CAST`  |  演员阵容（<expression>饰演<data type>）  |  将计算结果为单个值的实体或表达式从一种类型转换为另一种类型。 支持的数据类型包括： [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  | 

**Example 使用列出的函数进行的 SQL 查询：**  

```
SELECT TO_TIMESTAMP (100) AS timestamp_value,
  TO_DATE(r.event_timestamp) AS date_value,
  TO_TIME(r.event_timestamp) AS time_value
FROM raw_time_series AS r
```