'Converts the query into a date extraction query.'

def add_date_select(self, field, lookup_type, order='ASC'):

    result = self.setup_joins([field.name], self.get_meta(), self.get_initial_alias(), False)
    alias = result[3][(-1)]
    select = Date((alias, field.column), lookup_type)
    self.select = [select]
    self.select_fields = [None]
    self.select_related = False
    self.set_extra_mask([])
    self.distinct = True
    self.order_by = (((order == 'ASC') and [1]) or [(-1)])
