Skip to content

daft.functions.current_timezone#

current_timezone #

current_timezone() -> Expression

Returns the current timezone as a string (always 'UTC' in Daft).

Returns:

Name Type Description
Expression Expression

a String expression containing 'UTC', broadcast to every row.

Examples:

1
2
3
4
5
>>> import daft
>>> from daft.functions import current_timezone
>>> df = daft.from_pydict({"x": [1, 2, 3]})
>>> df = df.with_column("tz", current_timezone())
>>> df.schema()["tz"].dtype == daft.DataType.string()
True
Source code in daft/functions/datetime.py
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
def current_timezone() -> Expression:
    """Returns the current timezone as a string (always 'UTC' in Daft).

    Returns:
        Expression: a String expression containing 'UTC', broadcast to every row.

    Examples:
        >>> import daft
        >>> from daft.functions import current_timezone
        >>> df = daft.from_pydict({"x": [1, 2, 3]})
        >>> df = df.with_column("tz", current_timezone())
        >>> df.schema()["tz"].dtype == daft.DataType.string()
        True
    """
    return Expression._call_builtin_scalar_fn("current_timezone")