

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 類型轉換函數
<a name="sql-functions-type-conv"></a>

 類型轉換函數用於將值的資料類型從一個變更為另一個。它們對於確保資料相容性和執行需要特定格式資料的操作至關重要。


|  **函數**  |  **Signature**  |  **Description**  | 
| --- | --- | --- | 
| `TO_DATE` |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  | 
| `TO_TIMESTAMP` |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  | 
| `TO_TIME` |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/iot-sitewise/latest/userguide/sql-functions-type-conv.html)  | 
| `CAST` | CAST (<expression> AS <data type>) | 將評估為單一值的實體或表達式，從一種類型轉換為另一種類型。<br />支援的資料類型如下：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/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
```