Skip to content

Functions

koheesio.spark.functions.current_timestamp_utc #

current_timestamp_utc(spark: SparkSession) -> Column

Get the current timestamp in UTC

Source code in src/koheesio/spark/functions/__init__.py
def current_timestamp_utc(spark: SparkSession) -> Column:
    """Get the current timestamp in UTC"""
    tz_session = spark.conf.get("spark.sql.session.timeZone", "UTC")
    tz = tz_session if tz_session else "UTC"

    return f.to_utc_timestamp(f.current_timestamp(), tz)