Skip to content

daft.functions.current_date#

current_date #

current_date() -> Expression

Returns the current date (UTC).

Returns:

Name Type Description
Expression Expression

a Date expression containing today's date, broadcast to every row.

Examples:

1
2
3
4
5
>>> import daft
>>> from daft.functions import current_date
>>> df = daft.from_pydict({"x": [1, 2, 3]})
>>> df = df.with_column("today", current_date())
>>> df.schema()["today"].dtype == daft.DataType.date()
True
Source code in daft/functions/datetime.py
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
def current_date() -> Expression:
    """Returns the current date (UTC).

    Returns:
        Expression: a Date expression containing today's date, broadcast to every row.

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