from_utc_timestamp
The from_utc_timestamp function is used to convert a UTC timestamp to the local timestamp corresponding to the specified timezone.
Syntax
from_utc_timestamp(string timestamp, string timezone)
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| timestamp | Yes | DATE, TIMESTAMP, or STRING | UTC timestamp. Formats: yyyy-MM-dd yyyy-MM-dd HH:mm:ss yyyy-MM-dd HH:mm:ss.SSS |
| timezone | Yes | STRING | The target time zone for conversion. |
Return Values
Returns a timestamp of type TIMESTAMP.
- If timestamp is not of type DATE, TIMESTAMP, or STRING, an error is returned with the message "data type mismatch".
- If timestamp is of type DATE, TIMESTAMP, or STRING but does not conform to the input format for date values, NULL is returned.
- If the timestamp value is NULL, NULL is returned.
- If the timezone value is NULL, NULL is returned.
Example Code
Returns 1691978400000 (representing 2023-08-14 10:00:00).
select from_utc_timestamp('2023-08-14 17:00:00','PST'); Returns 1691917200000000 (representing 2023-08-13 17:00:00).
select from_utc_timestamp(date '2023-08-14 00:00:00','PST');
Returns NULL.
select from_utc_timestamp('2023-08-13',null); What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot