Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink Common

pyflink.table.expressions.convert_tz#

convert_tz(date_str: Union[str, Expression[str]], tz_from: Union[str, Expression[str]], tz_to: Union[str, Expression[str]]) → 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.

previous

pyflink.table.expressions.timestamp_diff

next

pyflink.table.expressions.from_unixtime

On this page
  • convert_tz()
Show Source

Created using Sphinx 5.3.0.