def day_of_year(datetimes):
    """Return the day of the year of given dates."""
    return (datetimes.astype('datetime64[D]', copy=False) -
            datetimes.astype('datetime64[Y]', copy=False)).astype(int)