> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ClickHouse の Date データ型に関するドキュメント

# Date

日付です。1970-01-01 からの日数を 2 バイトで格納します (符号なし) 。Unix エポックの開始直後から、コンパイル時に定数で定義された上限値までの値を格納できます (現在は 2149 年までですが、完全対応している最終年は 2148 年です) 。

サポートされる値の範囲: \[1970-01-01, 2149-06-06]。

日付の値は time zone を含まずに格納されます。

**例**

`Date` 型のカラムを持つテーブルを作成し、そこにデータを挿入する例:

```sql theme={null}
CREATE TABLE dt
(
    `timestamp` Date,
    `event_id` UInt8
)
ENGINE = TinyLog;
```

```sql theme={null}
-- 日付をパースする
-- - 文字列から、
-- - 1970-01-01 からの日数として解釈される「小さい」整数から、
-- - 1970-01-01 からの秒数として解釈される「大きい」整数から。
INSERT INTO dt VALUES ('2019-01-01', 1), (17897, 2), (1546300800, 3);

SELECT * FROM dt;
```

```text theme={null}
┌──timestamp─┬─event_id─┐
│ 2019-01-01 │        1 │
│ 2019-01-01 │        2 │
│ 2019-01-01 │        3 │
└────────────┴──────────┘
```

**関連項目**

* [日付と時刻を扱う関数](/ja/reference/functions/regular-functions/date-time-functions)
* [日付と時刻を扱う演算子](/ja/reference/operators#operators-for-working-with-dates-and-times)
* [`DateTime` データ型](/ja/reference/data-types/datetime)
