FROM_UTC_TIMESTAMP
Description
The FROM_UTC_TIMESTAMP function is used to convert a timestamp type data expr
representing UTC time to a local timestamp in the specified time zone timeZone
.
Description
expr
: A timestamp type data representing UTC time.timeZone
: The target time zone, represented as a string.
Return Result
The converted local timestamp, of type timestamp_ltz.
Usage Example
- Convert the UTC time '1970-01-01' to Beijing time:
- Convert multiple UTC timestamps to US Eastern Time:
- Convert the current UTC time to Sydney, Australia time:
Precautions
- Ensure the input timestamp format is correct, otherwise, the conversion may fail.
- The timezone string should use the standard timezone representation, such as 'Asia/Shanghai' or 'America/New_York'. If the timezone string is incorrect, it may lead to unexpected conversion results.
- During the conversion process, pay attention to the impact of daylight saving time. Some countries and regions implement daylight saving time during specific periods, which may cause time deviations.