---
title: make_dt_interval function
description: Learn the syntax of the make\_dt\_interval function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/make_dt_interval
---

# `make_dt_interval` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime 10.4 LTS and above

Creates an interval from `days`, `hours`, `mins` and `secs`.

## Syntax

```
make_dt_interval( [ days [, hours [, mins [, secs] ] ] ] )
```

## Arguments

* `days`: An integral number of days, positive or negative
* `hours`: An integral number of hours, positive or negative
* `mins`: An integral number of minutes, positive or negative
* `secs`: A number of seconds with the fractional part in microsecond precision.

## Returns

An `INTERVAL DAY TO SECOND`.

Unspecified arguments are defaulted to 0.
If you provide no arguments the result is an `INTERVAL '0 00:00:00.000000000' DAY TO SECOND`.

The function is equivalent to executing:

`INTERVAL days DAYS + INTERVAL hours HOURS + INTERVAL mins MINUTES + INTERVAL secs SECONDS`.

As such each unit can be outside of its natural range as well as negative.

If the result overflows, Databricks raises [INTERVAL\_ARITHMETIC\_OVERFLOW](https://docs.databricks.com/aws/en/error-messages/interval-arithmetic-overflow-error-class.md).

## Common error conditions

* [INTERVAL\_ARITHMETIC\_OVERFLOW](https://docs.databricks.com/aws/en/error-messages/interval-arithmetic-overflow-error-class.md)

## Examples

```sql
> SELECT make_dt_interval(100, 13);
  100 13:00:00.000000000

> SELECT make_dt_interval(100, null);
  NULL

> SELECT make_dt_interval(0, 25);
  1 01:00:00.000000000

> SELECT make_dt_interval(0, 0, 1, -0.1);
  0 00:00:59.900000000

> SELECT make_dt_interval(2147483647);
  Error: INTERVAL_ARITHMETIC_OVERFLOW
```

## Related functions

* [`make_date` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_date.md)
* [`make_timestamp` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp.md)
* [`make_ym_interval` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_ym_interval.md)
