"""Date and time utility functions."""

from datetime import datetime


def datetime_from_timestamp(timestamp: float) -> datetime:
    """
    Convert a Unix timestamp to a datetime object.

    Args:
        timestamp: Unix timestamp as float

    Returns:
        datetime object
    """
    return datetime.fromtimestamp(timestamp)


def strftime_filter(dt: datetime, fmt: str) -> str:
    """
    Format a datetime object using strftime.

    Args:
        dt: datetime object to format
        fmt: strftime format string

    Returns:
        Formatted datetime string
    """
    return dt.strftime(fmt)
