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
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
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")