> ## Documentation Index
> Fetch the complete documentation index at: https://risingwavelabs-wyx-add-timestamp-dedicated-page.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Timestamp

> Use the timestamp data type to handle date and time information.

Timestamp data types are used to store and process precise time information. RisingWave supports two types of timestamps:

* `timestamp`: Stores date and time values without timezone, supporting up to **nanosecond** precision (9 digits after the decimal point).

* `timestamptz`: Stores date and time values along with time zone information, supporting up to **microsecond** precision (6 digits after the decimal point).

## Precision preservation

<Note>
  Added in version 2.1.
</Note>

Nanosecond precision is fully maintained for `timestamp` during the following operations:

* Reading from or writing to external sources (Kafka, Iceberg, Parquet, etc.) preserves nanoseconds automatically.

* Adding or subtracting an interval from a timestamp.

  ```sql Add an interval theme={null}
  SELECT '2022-03-13 01:00:00.123456789'::timestamp + INTERVAL '24' HOUR;
  -- Result: 2022-03-14 01:00:00.123456789
  ```

  ```sql Subtract an interval theme={null}
  SELECT '2022-03-14 01:00:00.123456789'::timestamp - INTERVAL '24' HOUR;
  -- Result: 2022-03-13 01:00:00.123456789
  ```

## Precision loss

Nanosecond precision is lost (truncated to microseconds or discarded) under the following scenarios:

* Converting timestamp to types with lower precision:
  * timestamptz
  * time
  * date

* Subtracting Timestamps (timestamp - timestamp): The result is an interval, which only has microsecond precision.
  ```sql Subtract two timestamps theme={null}
  SELECT '2022-03-13 03:00:00.123456789'::timestamp - '2022-03-13 01:00:00.000000000'::timestamp;
  -- Result: 02:00:00.123456 (Note that nanosecond precision is truncated.)
  ```

## Related topic

For more functions and usage on timestamp, see [Date and time functions and operators](/sql/functions/datetime).
