def year_interval(year, milliseconds=False, return_string=False):
    """
    Return a start datetime and end datetime of a year.

    :param milliseconds: Minimum time resolution.
    :param return_string: If you want string instead of datetime, set True

    Usage Example::

        >>> start, end = rolex.year_interval(2007)
        >>> start
        datetime(2007, 1, 1, 0, 0, 0)

        >>> end
        datetime(2007, 12, 31, 23, 59, 59)
    """
    if milliseconds:  # pragma: no cover
        delta = timedelta(milliseconds=1)
    else:
        delta = timedelta(seconds=1)

    start = datetime(year, 1, 1)
    end = datetime(year + 1, 1, 1) - delta

    if not return_string:
        return start, end
    else:
        return str(start), str(end)
Return a start datetime and end datetime of a year.

    :param milliseconds: Minimum time resolution.
    :param return_string: If you want string instead of datetime, set True

    Usage Example::

        >>> start, end = rolex.year_interval(2007)
        >>> start
        datetime(2007, 1, 1, 0, 0, 0)

        >>> end
        datetime(2007, 12, 31, 23, 59, 59)