---
title: TIME type
description: The TIME type represents a time of day with hour, minute, and second values in Databricks SQL and Databricks Runtime 18 LTS and above.
canonical_url: https://docs.databricks.com/gcp/en/sql/language-manual/data-types/time-type
---

# `TIME` type

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

> [!NOTE]
>
> Databricks Runtime 18 is newer than Databricks Runtime 18.0, 18.1, and 18.2. Features that would previously have shipped as a later numbered version now ship as dated updates to Databricks Runtime 18 instead. For details, see [About unified release notes](https://docs.databricks.com/gcp/en/release-notes/runtime/18.md#unified-format).

> [!NOTE]
> **Beta**
>
> This feature is in [Beta](https://docs.databricks.com/gcp/en/release-notes/release-types.md).

Represents a time of day comprising values of fields hour, minute, and second, without a time-zone.

## Syntax

```
TIME | TIME(p)
```

`p`: An optional precision specifying the number of fractional digits in the seconds field.
Valid values are `0` to `6`. If `p` is omitted, the default precision is `6` (microseconds).

## Limits

The range of time values supported is `00:00:00.000000` to `23:59:59.999999`.

## Literals

```
TIME timeString

timeString
{ '[h]h:[m]m' |
  '[h]h:[m]m:[s]s' |
  '[h]h:[m]m:[s]s.[f...]' |
  '[h]h:[m]m AM|PM' |
  '[h]h:[m]m:[s]s AM|PM' |
  '[h]h:[m]m:[s]s.[f...] AM|PM' }
```

* `[h]h`: A one or two digit hour between `00` and `23` (24-hour format) or between `01` and `12` (12-hour format with `AM`/`PM`).
* `[m]m`: A one or two digit minute between `00` and `59`.
* `[s]s`: A one or two digit second between `00` and `59`.
* `[f...]`: Up to 6 digits of fractional seconds.
* `AM` or `PM`: An optional case-insensitive suffix indicating a 12-hour clock value.

The prefix `TIME` is case insensitive.

If the second component is not specified it defaults to `0`.

If the literal does not represent a proper time Databricks raises an error.

## Precision rules

When two `TIME` values with different precisions are combined (for example, in [COALESCE](https://docs.databricks.com/gcp/en/sql/language-manual/functions/coalesce.md), [CASE](https://docs.databricks.com/gcp/en/sql/language-manual/functions/case.md), [UNION](https://docs.databricks.com/gcp/en/sql/language-manual/sql-ref-syntax-qry-select-setops.md), or arithmetic), the result uses the wider of the two precisions.

For example, the least common type of `TIME(3)` and `TIME(6)` is `TIME(6)`.

When you cast a `TIME` value to a lower precision, the fractional seconds are **truncated**, not rounded:

```sql
> SELECT CAST(TIME'12:30:45.987654' AS TIME(3));
  12:30:45.987
```

When you add or subtract a day-time interval to a `TIME`, the result uses the wider of the `TIME` precision and the interval's fractional second precision. For example, `TIME(0) + INTERVAL '1.123456' SECOND` returns a `TIME(6)`. If the result falls outside `[00:00:00, 24:00:00)`, Databricks raises [DATETIME\_OVERFLOW](https://docs.databricks.com/gcp/en/error-messages/error-classes.md#datetime_overflow).

## Notes

All operations on `TIME` values are performed without taking any time zone into account.

To use `TIME` columns in Delta Lake tables, support is enabled automatically when you create a new Delta table with a column of `TIME` type. To add a `TIME` column to an existing table, you must first enable the feature:

```sql
ALTER TABLE table_name SET TBLPROPERTIES ('delta.feature.timeType' = 'supported')
```

The `TIME` type has the following limitations:

* Not supported in generated columns.
* Not supported for bloom filter indexes.
* Not supported for Z-Ordering.

## Examples

```sql
> SELECT TIME'10:30:00';
  10:30:00

> SELECT TIME'08:15';
  08:15:00

> SELECT TIME'23:59:59.123456';
  23:59:59.123456

> SELECT CAST('14:30:00' AS TIME);
  14:30:00

> SELECT CAST('09:15:30.5' AS TIME(3));
  09:15:30.500

> SELECT current_time();
  16:57:04.304361

> SELECT make_time(6, 30, 45.887);
  06:30:45.887000
```

## Related

* [`TIMESTAMP` type](https://docs.databricks.com/gcp/en/sql/language-manual/data-types/timestamp-type.md)
* [`TIMESTAMP_NTZ` type](https://docs.databricks.com/gcp/en/sql/language-manual/data-types/timestamp-ntz-type.md)
* [`DATE` type](https://docs.databricks.com/gcp/en/sql/language-manual/data-types/date-type.md)
* [`cast` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/cast.md)
* [`current_time` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/current_time.md)
* [`localtime` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/localtime.md)
* [`make_time` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/make_time.md)
* [`time` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time.md)
* [`to_time` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/to_time.md)
* [`try_to_time` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/try_to_time.md)
* [`time_trunc` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time_trunc.md)
* [`time_diff` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time_diff.md)
* [`time_from_seconds` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time_from_seconds.md)
* [`time_from_millis` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time_from_millis.md)
* [`time_from_micros` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time_from_micros.md)
* [`time_to_seconds` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time_to_seconds.md)
* [`time_to_millis` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time_to_millis.md)
* [`time_to_micros` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/time_to_micros.md)
