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 = "(%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)
Implements the interval functionality for expressions
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/db/backends/oracle/base.py/DatabaseOperations.date_interval_sql