'Implements the interval functionality for expressions
format for Oracle:
(datefield + INTERVAL \'3 00:03:20.000000\' DAY(1) TO SECOND(6))'

def date_interval_sql(self, sql, connector, timedelta):

    (minutes, seconds) = divmod(timedelta.seconds, 60)
    (hours, minutes) = divmod(minutes, 60)
    days = str(timedelta.days)
    day_precision = len(days)
    fmt = u"(%s    %s    INTERVAL    '%s    %02d:%02d:%02d.%06d'    DAY(%d)    TO    SECOND(6))"
    return (fmt % (sql, connector, days, hours, minutes, seconds, timedelta.microseconds, day_precision))
