pyflink.table.expressions.convert_tz#
- convert_tz(date_str: Union[str, pyflink.table.expression.Expression[str]], tz_from: Union[str, pyflink.table.expression.Expression[str]], tz_to: Union[str, pyflink.table.expression.Expression[str]]) pyflink.table.expression.Expression [source]#
Converts a datetime string date_str (with default ISO timestamp format ‘yyyy-MM-dd HH:mm:ss’) from time zone tz_from to time zone tz_to. The format of time zone should be either an abbreviation such as “PST”, a full name such as “America/Los_Angeles”, or a custom ID such as “GMT-08:00”. E.g., convert_tz(‘1970-01-01 00:00:00’, ‘UTC’, ‘America/Los_Angeles’) returns ‘1969-12-31 16:00:00’.
Example:
>>> tab.select(convert_tz(col('a'), 'PST', 'UTC'))
- Parameters
date_str – the date time string
tz_from – the original time zone
tz_to – the target time zone
- Returns
The formatted timestamp as string.
New in version 1.12.0.