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
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
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)