Skip to content

daft.functions.last_day#

last_day #

last_day(expr: Expression) -> Expression

Returns the last day of the month for the given date or timestamp.

Parameters:

Name Type Description Default
expr Expression

a Date or Timestamp expression.

required

Returns:

Name Type Description
Expression Expression

a Date expression representing the last day of that month.

Examples:

1
2
3
>>> import daft
>>> from daft.functions import last_day
>>> last_day(daft.col("dt"))
last_day(col(dt))
Source code in daft/functions/datetime.py
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
def last_day(expr: Expression) -> Expression:
    """Returns the last day of the month for the given date or timestamp.

    Args:
        expr: a Date or Timestamp expression.

    Returns:
        Expression: a Date expression representing the last day of that month.

    Examples:
        >>> import daft
        >>> from daft.functions import last_day
        >>> last_day(daft.col("dt"))
        last_day(col(dt))
    """
    expr = Expression._to_expression(expr)
    return Expression._call_builtin_scalar_fn("last_day", expr)