def date_to_number(self, date):
if isinstance(date, datetime.datetime):<EOL><INDENT>delta = date - self._null_date<EOL><DEDENT>elif isinstance(date, datetime.date):<EOL><INDENT>delta = date - self._null_date.date()<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(date)<EOL><DEDENT>return delta.days + delta.seconds / (<NUM_LIT> * <NUM_LIT> * <NUM_LIT>)<EOL>
Converts a date or datetime instance to a corresponding float value.