def day=(value)
      value = 0 if value.nil?

      if value.is_a?(String) 
        if value.length == 0
          value = 0
        elsif value =~ /\A\d{1,2}\z/
          value = value.to_i
        else
          raise DayError, "Day must be a valid one or two digit string or integer between 0 and 31"
        end
      end

      if (value >= 0 && value <= 31)
        raise DayError, "A month must be set before a day" if month == 0 && value !=0
        begin
          date = ::Date.civil(self.year, self.month, value) if value > 0
          @bits = self.class.set_day(@bits, value)
        rescue 
          raise DayError, "Day must be a valid day for the given month"
        end
      else
        raise DayError, "Day must be an integer between 0 and 31"
      end
    end
def day=(value)
      value = 0 if value.nil?

      if value.is_a?(String) 
        if value.length == 0
          value = 0
        elsif value =~ /\A\d{1,2}\z/
          value = value.to_i
        else
          raise DayError, "Day must be a valid one or two digit string or integer between 0 and 31"
        end
      end

      if (value >= 0 && value <= 31)
        raise DayError, "A month must be set before a day" if month == 0 && value !=0
        begin
          date = ::Date.civil(self.year, self.month, value) if value > 0
          @bits = self.class.set_day(@bits, value)
        rescue 
          raise DayError, "Day must be a valid day for the given month"
        end
      else
        raise DayError, "Day must be an integer between 0 and 31"
      end
    end
Public: Set the day portion of a partial date. Day is optional so zero,
 nil and empty strings are allowed.