def day(t, now=None, format='%B %d'):
    '''
    Date delta compared to ``t``. You can override ``now`` to specify what date
    to compare to.

    You can override the date format by supplying a ``format`` parameter.

    :param t: timestamp, :class:`datetime.date` or :class:`datetime.datetime`
              object
    :param now: default ``None``, optionally a :class:`datetime.datetime`
                object
    :param format: default ``'%B %d'``

    >>> import time
    >>> print(day(time.time()))
    today
    >>> print(day(time.time() - 86400))
    yesterday
    >>> print(day(time.time() - 604800))
    last week
    >>> print(day(time.time() + 86400))
    tomorrow
    >>> print(day(time.time() + 604800))
    next week
    '''
    t1 = _to_date(t)
    t2 = _to_date(now or datetime.datetime.now())
    diff = t1 - t2
    secs = _total_seconds(diff)
    days = abs(diff.days)

    if days == 0:
        return _('today')
    elif days == 1:
        if secs < 0:
            return _('yesterday')
        else:
            return _('tomorrow')
    elif days == 7:
        if secs < 0:
            return _('last week')
        else:
            return _('next week')
    else:
        return t1.strftime(format)
Date delta compared to ``t``. You can override ``now`` to specify what date
    to compare to.

    You can override the date format by supplying a ``format`` parameter.

    :param t: timestamp, :class:`datetime.date` or :class:`datetime.datetime`
              object
    :param now: default ``None``, optionally a :class:`datetime.datetime`
                object
    :param format: default ``'%B %d'``

    >>> import time
    >>> print(day(time.time()))
    today
    >>> print(day(time.time() - 86400))
    yesterday
    >>> print(day(time.time() - 604800))
    last week
    >>> print(day(time.time() + 86400))
    tomorrow
    >>> print(day(time.time() + 604800))
    next week