CONVERT_TIMEZONE
Description
The CONVERT_TIMEZONE
function is used to convert a specified timestamp from one time zone to another. This function can handle different types of time format inputs and automatically perform type conversion when necessary.
Syntax
source_tz
string : Original time zone. If only two parameters are provided, the current session's time zone is used as the default original time zone.target_tz
string : Target time zone.ts
int or timestamp : Timestamp. If it is an integer type, the function will automatically convert it to a timestamp type.
Return Value
Converted timestamp.
Example
Notes
- Please ensure that the input timezone name is valid, otherwise the function will return an error.
- When the input timestamp format is incorrect or unrecognizable, the function will automatically attempt type conversion.
- If the input timestamp is already in the target timezone, the function will directly return that timestamp.
By using the CONVERT_TIMEZONE
function, you can easily convert timestamps between different timezones, ensuring the accuracy and consistency of the data.