# UNIXタイムスタンプ変換

> UNIXタイムスタンプを日時へ、または日時からタイムスタンプへ変換できます。リアルタイムの現在時刻、ローカル時間、UTC、相対時間も表示。無料で利用可能です。

URL: https://acrafto.com/ja/unix-timestamp-converter/

Tools are interactive browser apps; there is no public API, no endpoints to call and no server-side processing. To use a tool, open its HTML page in a browser.

## UNIXタイムスタンプ変換ツール（オンラインUNIX時間変換器）

この**UNIXタイムスタンプ変換ツール**を使用すると、**UNIX時間（エポックタイム / POSIXタイム）**を**日付と時刻**に、またはその逆に素早く変換できます。**秒単位とミリ秒単位のタイムスタンプ**をサポートし、**ローカル時間**、**UTC**、**ISO 8601**を表示し、結果はワンクリックで**コピー**できます。

---

## UNIXタイムスタンプ（エポックタイム / POSIXタイム）とは？

**UNIXタイムスタンプ**とは、**1970年1月1日 00:00:00 UTCからの秒数**（いわゆる**UNIXエポック**）として時間を表現する数値です。実際には、システム、データベース、API、ロギングにおいて、日付と時刻を保存および転送するための最も広く使用されている形式の1つです。

**例:** `1700000000` は **2023年11月14日 22:13:20 UTC** に相当します。

### なぜ1970年1月1日なのか？

エポックの開始（1970年1月1日）は、UNIXの設計時に実用的な参照点として選ばれました。システムの開発期間に近く、時間の計算を簡素化できるためです。

---

## UNIXタイムスタンプ：秒単位 vs ミリ秒単位

UNIXタイムスタンプは、主に2つの形式で存在します。

| タイムスタンプの形式 | 例 | 一般的な用途 |
| --- | ---: | --- |
| **秒 (s)** | `1700000000` | データベース、バックエンド、API、ファイル |
| **ミリ秒 (ms)** | `1700000000000` | JavaScript (`Date.now()`)、分析、詳細ログ |

**どちらの形式かを見分けるには？**

- 「今日の」日付の場合、**秒単位**のタイムスタンプは通常**10桁**です。
- **ミリ秒単位**のタイムスタンプは通常**13桁**で、およそ**1000倍**大きいです。
- 目安として、値が **\> 10¹²** の場合、ほぼ確実に**ミリ秒単位**です。

---

## UNIXタイムスタンプ変換ツールの使い方

### 1) タイムスタンプ → 日時

1. フィールドに**UNIXタイムスタンプ**を入力するか、「**現在**」（現在のUNIX時間）をクリックします。
2. タイムスタンプが**ミリ秒単位**の場合は、「**ミリ秒を使用**」オプションを有効にします。
3. 「**変換**」をクリックします（またはEnterキーを押します）。
4. **ローカル時間**、**UTC**、**ISO 8601**への変換が表示されます。
5. 結果をクリックすると、**クリップボードにコピー**されます。

### 2) 日時 → タイムスタンプ

1. フォームで**日付と時刻**を選択します。
2. 「**変換**」をクリックします。
3. 結果は**秒単位とミリ秒単位のタイムスタンプ**として表示されます。

---

## UNIXタイムスタンプが最もよく使われる場所

UNIX時間は、ITで時間を扱うほとんどすべての場所で見られます。

- **データベース** – MySQL、PostgreSQL、SQLiteなどで時間を保存し、比較するため。
- **API** – REST/GraphQLは、タイムスタンプとして時間を返すことがよくあります（簡単なシリアル化のため）。
- **ログと監視** – イベントを時間順に正確に並べ替えるため。
- **Git** – コミットには時間データが含まれています。
- **ファイルシステム** – mtime/ctime/atime（最終変更日時など）として。
- **JWT** – `iat`（発行時刻）および`exp`（有効期限）クレームは、通常エポック秒です。
- **Linux/Unixシェル** – `date +%s`は現在のタイムスタンプを返します。
- **JavaScript** – `Date.now()`は時間を**ミリ秒単位**で返します。

---

## UNIX時間変換の具体的な例

### JavaScript (タイムスタンプ ↔ 日付)

```
// 現在のUNIXタイムスタンプ（秒）
const tsSeconds = Math.floor(Date.now() / 1000);

// 現在のタイムスタンプ（ミリ秒）
const tsMs = Date.now();

// タイムスタンプ (s) -> 日付
const dateFromSeconds = new Date(1700000000 * 1000);
console.log(dateFromSeconds.toISOString());

// 日付 -> タイムスタンプ (s)
const ts = Math.floor(new Date("2024-01-01T00:00:00Z").getTime() / 1000);
console.log(ts);
```

### Python (タイムスタンプ ↔ datetime)

```
import time
from datetime import datetime, timezone

# 現在のタイムスタンプ（秒）
ts = int(time.time())

# タイムスタンプ -> datetime (UTC)
dt_utc = datetime.fromtimestamp(1700000000, tz=timezone.utc);

# 日付 -> タイムスタンプ
ts2 = int(datetime(2024, 1, 1, tzinfo=timezone.utc).timestamp());
```

### SQL (MySQL)

```
-- 現在のUNIXタイムスタンプ（秒）
SELECT UNIX_TIMESTAMP();

-- タイムスタンプ -> 日付
SELECT FROM_UNIXTIME(1700000000);

-- 日付 -> タイムスタンプ
SELECT UNIX_TIMESTAMP('2024-01-01 00:00:00');
```

---

## タイムゾーン：UTC、ローカル時間、ISO 8601

**UNIXタイムスタンプは常にUTC**です。タイムゾーンや夏時間の情報は含まれていません。ローカル時間への変換は、ブラウザ、サーバー、または使用されるライブラリの設定に依存します。

知っておくと役立つ用語：

- **UTC** – 夏時間/冬時間のないグローバル標準。
- **GMT** – 通常の使用ではUTCと実質的に同じです。
- **オフセット** – UTCからのずれ（例: プラハは冬に**UTC+1**、夏に**UTC+2**）。

---

## UNIXタイムスタンプの制限と2038年問題

### 2038年問題 (Year 2038 Problem)

一部の**32ビットシステム**では、タイムスタンプが最大値**2,147,483,647**の`int32`として保存されます。これは**2038年1月19日 03:14:07 UTC**に相当します。この値を超えると、オーバーフローが発生し、時間が誤って表示される可能性があります。現代の**64ビット**システムでは、通常この問題はありません。

### 64ビットUNIX時間の範囲

64ビット値は非常に広範囲の期間をカバーします（実際には「永遠に」）。負の値は**1970年1月1日より前の日付**を意味します。

---

## FAQ – UNIXタイムスタンプに関するよくある質問

### UNIXタイムスタンプはUTCですか、それともローカル時間ですか？

UNIXタイムスタンプは常に**UTC**です。ローカル時間は、タイムゾーンに基づいて変換されたときに初めて生成されます。したがって、変換ツールは通常、UTCとローカル時間の両方を表示します。

### タイムスタンプが秒単位かミリ秒単位か、どうすればわかりますか？

現在の時刻の場合、**秒単位**のタイムスタンプは通常**10桁**です。**ミリ秒単位**は通常**13桁**で、およそ**1000倍**大きいです。目安として、値が **\> 10¹²** の場合、ミリ秒単位である可能性が高いです。

### 負のUNIXタイムスタンプは何を意味しますか？

負のタイムスタンプは、**1970年1月1日より前の日付**を表します。例えば、`-1`は**1969年12月31日 23:59:59 UTC**に相当します。

### SQLでUNIXタイムスタンプを変換するにはどうすればよいですか？

MySQLでは、`FROM_UNIXTIME(timestamp)`を使用して日付に変換し、`UNIX_TIMESTAMP(date)`を使用してタイムスタンプに戻します。PostgreSQLでは、通常`TO_TIMESTAMP(timestamp)`と`EXTRACT(EPOCH FROM datum)`を使用します。

### UNIXエポックはなぜ1970年1月1日に始まるのですか？

これは、UNIX開発の初期に歴史的に選ばれた参照点です。シンプルで実用的であり、システム開発の時期に近いためです。

## Other languages

- Čeština (cs): [Unix timestamp převodník](https://acrafto.com/cs/unix-timestamp/) ([Markdown](https://acrafto.com/cs/unix-timestamp/index.md))
- Slovenčina (sk): [Unix timestamp konvertor](https://acrafto.com/sk/unix-timestamp-prevodnik/) ([Markdown](https://acrafto.com/sk/unix-timestamp-prevodnik/index.md))
- English (en): [UNIX Timestamp Converter](https://acrafto.com/en/unix-timestamp-converter/) ([Markdown](https://acrafto.com/en/unix-timestamp-converter/index.md))
- Deutsch (de): [Unix Timestamp umrechnen](https://acrafto.com/de/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/de/unix-timestamp-konverter/index.md))
- Français (fr): [Convertisseur timestamp Unix](https://acrafto.com/fr/convertisseur-timestamp-unix/) ([Markdown](https://acrafto.com/fr/convertisseur-timestamp-unix/index.md))
- Español (es): [Convertidor de UNIX timestamp](https://acrafto.com/es/convertidor-timestamp-unix/) ([Markdown](https://acrafto.com/es/convertidor-timestamp-unix/index.md))
- Italiano (it): [Convertitore timestamp UNIX](https://acrafto.com/it/convertitore-timestamp-unix/) ([Markdown](https://acrafto.com/it/convertitore-timestamp-unix/index.md))
- Português (pt): [Conversor de timestamp Unix](https://acrafto.com/pt/conversor-timestamp-unix/) ([Markdown](https://acrafto.com/pt/conversor-timestamp-unix/index.md))
- Nederlands (nl): [Unix timestamp converter](https://acrafto.com/nl/unix-timestamp-converter/) ([Markdown](https://acrafto.com/nl/unix-timestamp-converter/index.md))
- Polski (pl): [Konwerter UNIX timestamp](https://acrafto.com/pl/konwerter-unix-timestamp/) ([Markdown](https://acrafto.com/pl/konwerter-unix-timestamp/index.md))
- Română (ro): [Convertor Unix timestamp](https://acrafto.com/ro/convertor-unix-timestamp/) ([Markdown](https://acrafto.com/ro/convertor-unix-timestamp/index.md))
- Magyar (hu): [UNIX időbélyeg konvertáló](https://acrafto.com/hu/unix-idobelyeg-atalakito/) ([Markdown](https://acrafto.com/hu/unix-idobelyeg-atalakito/index.md))
- Ελληνικά (el): [Μετατροπέας Unix timestamp](https://acrafto.com/el/unix-timestamp-converter/) ([Markdown](https://acrafto.com/el/unix-timestamp-converter/index.md))
- Български (bg): [Unix timestamp конвертор](https://acrafto.com/bg/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/bg/unix-timestamp-konverter/index.md))
- Hrvatski (hr): [Unix timestamp konverter](https://acrafto.com/hr/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/hr/unix-timestamp-konverter/index.md))
- Slovenščina (sl): [Pretvornik Unix timestamp](https://acrafto.com/sl/unix-timestamp-pretvornik/) ([Markdown](https://acrafto.com/sl/unix-timestamp-pretvornik/index.md))
- Eesti (et): [UNIX timestamp teisendaja](https://acrafto.com/et/unix-timestamp-teisendaja/) ([Markdown](https://acrafto.com/et/unix-timestamp-teisendaja/index.md))
- Latviešu (lv): [UNIX laika zīmogu pārveidotājs](https://acrafto.com/lv/unix-timestamp-konvertetajs/) ([Markdown](https://acrafto.com/lv/unix-timestamp-konvertetajs/index.md))
- Lietuvių (lt): [UNIX laiko žymės keitiklis](https://acrafto.com/lt/unix-laiko-zymes-keitiklis/) ([Markdown](https://acrafto.com/lt/unix-laiko-zymes-keitiklis/index.md))
- Svenska (sv): [Unix timestamp-omvandlare](https://acrafto.com/sv/unix-timestamp-omvandlare/) ([Markdown](https://acrafto.com/sv/unix-timestamp-omvandlare/index.md))
- Dansk (da): [UNIX timestamp konverter](https://acrafto.com/da/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/da/unix-timestamp-konverter/index.md))
- Suomi (fi): [UNIX-aikaleiman muunnin](https://acrafto.com/fi/unix-aikaleiman-muunnin/) ([Markdown](https://acrafto.com/fi/unix-aikaleiman-muunnin/index.md))
- Norsk (no): [Unix timestamp-konverterer](https://acrafto.com/no/unix-tidsstempel-konverterer/) ([Markdown](https://acrafto.com/no/unix-tidsstempel-konverterer/index.md))
- Українська (uk): [Конвертер Unix timestamp](https://acrafto.com/uk/konverter-unix-chasu/) ([Markdown](https://acrafto.com/uk/konverter-unix-chasu/index.md))
- Русский (ru): [Unix timestamp конвертер](https://acrafto.com/ru/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/ru/unix-timestamp-konverter/index.md))
- Српски (sr): [UNIX timestamp konverter](https://acrafto.com/sr/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/sr/unix-timestamp-konverter/index.md))
- Македонски (mk): [UNIX timestamp конвертор](https://acrafto.com/mk/unix-timestamp-konvertor/) ([Markdown](https://acrafto.com/mk/unix-timestamp-konvertor/index.md))
- Bosanski (bs): [Unix timestamp konverter](https://acrafto.com/bs/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/bs/unix-timestamp-konverter/index.md))
- Shqip (sq): [Konvertues Unix timestamp](https://acrafto.com/sq/konvertues-timestamp-unix/) ([Markdown](https://acrafto.com/sq/konvertues-timestamp-unix/index.md))
- Türkçe (tr): [UNIX zaman damgası dönüştürücü](https://acrafto.com/tr/unix-zaman-damgasi-donusturucu/) ([Markdown](https://acrafto.com/tr/unix-zaman-damgasi-donusturucu/index.md))
- 한국어 (ko): [유닉스 타임스탬프 변환기](https://acrafto.com/ko/unix-timestamp-converter/) ([Markdown](https://acrafto.com/ko/unix-timestamp-converter/index.md))
- العربية (ar): [محول Unix Timestamp](https://acrafto.com/ar/unix-timestamp-converter/) ([Markdown](https://acrafto.com/ar/unix-timestamp-converter/index.md))
- हिन्दी (hi): [UNIX टाइमस्टैम्प कनवर्टर](https://acrafto.com/hi/unix-timestamp-converter/) ([Markdown](https://acrafto.com/hi/unix-timestamp-converter/index.md))
- Bahasa Indonesia (id): [Konverter Unix timestamp](https://acrafto.com/id/konverter-timestamp-unix/) ([Markdown](https://acrafto.com/id/konverter-timestamp-unix/index.md))
- Tiếng Việt (vi): [Chuyển đổi Unix timestamp](https://acrafto.com/vi/bo-chuyen-doi-unix-timestamp/) ([Markdown](https://acrafto.com/vi/bo-chuyen-doi-unix-timestamp/index.md))
- ไทย (th): [แปลง Unix Timestamp](https://acrafto.com/th/unix-timestamp-converter/) ([Markdown](https://acrafto.com/th/unix-timestamp-converter/index.md))
- עברית (he): [ממיר Unix Timestamp](https://acrafto.com/he/unix-timestamp-converter/) ([Markdown](https://acrafto.com/he/unix-timestamp-converter/index.md))
