Guide
UTC と GMT の違い
はじめに
UTC と GMT は、開発者とユーザーの両方がよく混同する 2 つの時間標準です。これらは日常の使用では交換可能に見えるかもしれませんが、ソフトウェア開発、時間に敏感なアプリケーション、およびグローバル システムにとって重要な重要な技術的な違いがあります。
簡単な概要: UTC は原子時計に基づいた正確な時間標準ですが、GMT は天文観測に基づいています。 UTC はほとんどのアプリケーションの最新の標準ですが、GMT は主にタイム ゾーン名です。
UTC とは何ですか?
定義
UTC (協定世界時) は、世界が時計と時間を規制するための主要な時間標準です。これは国際原子時 (TAI) に基づいており、UT1 (太陽時) の 0.9 秒以内に収まるように閏秒が追加されています。
UTC Characteristics:
- Based on: Atomic clocks (International Atomic Time - TAI)
- Precision: ±0.9 seconds from UT1 (solar time)
- Time Zone: No time zone offset (UTC+0)
- Daylight Saving: No DST adjustments
- Usage: Worldwide standard for computing, internet, and aviation
主な機能
- 原子時間基準: UTC は、極めて高い精度を実現するために世界中で何百もの原子時計を使用しています。
- うるう秒: 地球の自転との同期を保つために時々 1 秒調整します
- ユニバーサル基準: すべてのタイムゾーンの基準時間として使用されます (UTC+X、UTC-X)
- DST フリー: 夏時間に変更されることはありません
コード例: UTC 時刻の取得
// Get current UTC time
const now = new Date();
const utcString = now.toISOString(); // "2026-01-01T12:00:00.000Z"
const utcTimestamp = Math.floor(now.getTime() / 1000); // 1735689600
console.log('UTC ISO String:', utcString);
console.log('UTC Timestamp:', utcTimestamp);
from datetime import datetime, timezone
# Get current UTC time
now_utc = datetime.now(timezone.utc)
utc_iso = now_utc.isoformat()
utc_timestamp = int(now_utc.timestamp())
print(f'UTC ISO String: {utc_iso}')
print(f'UTC Timestamp: {utc_timestamp}')
import java.time.Instant;
import java.time.ZoneOffset;
// Get current UTC time
Instant now = Instant.now();
String utcIso = now.toString();
long utcTimestamp = now.getEpochSecond();
System.out.println("UTC ISO String: " + utcIso);
System.out.println("UTC Timestamp: " + utcTimestamp);
GMT とは何ですか?
定義
GMT (グリニッジ標準時) は、もともとロンドンのグリニッジにある王立天文台の太陽時に基づいたタイムゾーンです。歴史的には、世界の主要な標準時間として使用されてきましたが、現在では大部分が UTC に取って代わられています。
GMT Characteristics:
- Based on: Astronomical observations (solar time at Greenwich)
- Precision: Varies with Earth's rotation irregularities
- Time Zone: UTC+0 (during winter), UTC+1 (during summer in UK)
- Daylight Saving: Subject to UK daylight saving time (BST)
- Usage: UK time zone name, some maritime operations
歴史的背景
GMT は 1884 年に国際子午線会議で設立されました。 1960 年代に UTC が採用されるまでは、これが世界の主要な時間標準でした。
コード例: GMT 時刻の取得
// Get current GMT (London) time
const now = new Date();
const options = { timeZone: 'Europe/London', timeZoneName: 'short' };
const gmtString = now.toLocaleString('en-US', options);
console.log('GMT/London Time:', gmtString);
// Note: This shows GMT or BST depending on UK daylight saving
# Get current GMT (London) time
from datetime import datetime
import pytz
# Get current GMT (London) time
london_tz = pytz.timezone('Europe/London')
now_london = datetime.now(london_tz)
print(f'GMT/London Time: {now_london.strftime("%Y-%m-%d %H:%M:%S %Z")}')
# Note: This shows GMT or BST depending on UK daylight saving
// Get current GMT (London) time
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
// Get current GMT (London) time
ZoneId londonZone = ZoneId.of("Europe/London");
ZonedDateTime londonTime = ZonedDateTime.now(londonZone);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss z");
System.out.println("GMT/London Time: " + londonTime.format(formatter));
// Note: This shows GMT or BST depending on UK daylight saving
主な違い: UTC と GMT
比較表
| 特集 | UTC (協定世界時) | GMT (グリニッジ標準時) |
|---|---|---|
| に基づく | 原子時計 (TAI) | グリニッジでの太陽観測 |
| 精度 | ±0.9秒 | 地球の自転に応じて変化します |
| タイムゾーン | 変更しない (UTC+0) | 英国の DST (GMT/BST) に伴う変更 |
| 夏時間の調整 | いいえ | はい (英国は夏に BST に続きます) |
| うるう秒 | はい (地球の自転に一致させるため) | いいえ (うるう秒を使用しません) |
| 主な用途 | コンピューティング、インターネット、航空 | 英国のタイムゾーン、海事 |
| ISO 8601 | UTC 標準を使用 | ISO 8601 の標準ではありません |
| プログラミング API | ほとんどは内部的に UTC を使用します。 API ではほとんど使用されません |
うるう二番目の要素
UTC は、地球の自転との同期を保つために うるう秒を時々加算または減算します。 2026 年の時点での違いは次のとおりです。
UTC - TAI = -37 seconds (UTC is 37 seconds behind atomic time)
UTC - UT1 = ±0.9 seconds (UTC is kept close to solar time)
Current UTC-GMT offset: Usually 0, but varies slightly due to leap seconds
重要: UTC と GMT は日常使用では同じものとして扱われることがよくありますが、うるう秒により最大 0.9 秒異なる場合があります。ほとんどのアプリケーションでは、この違いは無視できますが、次の場合には重要です。
- 高頻度取引
- 科学的研究
- 正確な同期システム
UTC と GMT をいつ使用するか
UTC を使用する場合
- ソフトウェア開発: ほとんどのプログラミング言語は内部的に UTC を使用します。
- データベース タイムスタンプ: 一貫性を保つためにすべての時間を UTC で保存します
- API レスポンス: 汎用解釈のために UTC タイムスタンプを返します
- グローバル システム: 複数のタイム ゾーンで使用されるアプリケーション
- 同期: 正確な時間調整が必要なシステム
// Example: Store timestamps in UTC database
const timestamp = Date.now(); // UTC milliseconds
// Store in database: 17356896000000
// Display in user's local time
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const localTime = new Date(timestamp).toLocaleString('en-US', { timeZone: userTimeZone });
GMT を使用する場合
- 英国のタイムゾーン: 英国 (ヨーロッパ/ロンドン) の時間を表します。
- 履歴データ: GMT が標準であった 1972 年以前のタイムスタンプの処理
- 海上業務: 一部の海上システムは依然として GMT を参照しています
- レガシー システム: 特に GMT を使用する古いシステム
// Example: UK time zone handling
const now = new Date();
const ukTime = now.toLocaleString('en-GB', { timeZone: 'Europe/London' });
// Displays as "01/01/2026, 12:00:00 GMT" or "01/01/2026, 13:00:00 BST"
タイムゾーン変換の例
現地時間を UTC に変換する
function convertToUTC(dateString, timeZone) {
const date = new Date(dateString);
const utcString = date.toISOString();
const utcTimestamp = Math.floor(date.getTime() / 1000);
return {
input: dateString,
timeZone: timeZone,
utcString: utcString,
utcTimestamp: utcTimestamp
};
}
// Example: Convert Tokyo time to UTC
const result = convertToUTC('2026-01-01 20:00:00', 'Asia/Tokyo');
console.log(result);
// Output: { utcString: "2026-01-01T11:00:00.000Z", utcTimestamp: 1735659600 }
from datetime import datetime
import pytz
def convert_to_utc(date_string, time_zone):
tz = pytz.timezone(time_zone)
local_time = tz.localize(datetime.strptime(date_string, "%Y-%m-%d %H:%M:%S"))
utc_time = local_time.astimezone(pytz.UTC)
return {
"input": date_string,
"time_zone": time_zone,
"utc_string": utc_time.isoformat(),
"utc_timestamp": int(utc_time.timestamp())
}
# Example: Convert Tokyo time to UTC
result = convert_to_utc('2026-01-01 20:00:00', 'Asia/Tokyo')
print(result)
# Output: {'utc_string': '2026-01-01T11:00:00Z', 'utc_timestamp': 1735659600}
UTC タイム ゾーン オフセットのリファレンス
UTC+0: London (winter), Dublin (winter), Lisbon (winter)
UTC+1: Berlin, Paris, Rome, Madrid (winter), London (summer/BST)
UTC+2: Cairo, Helsinki, Athens, Johannesburg
UTC+3: Moscow, Istanbul, Baghdad, Nairobi
UTC+4: Dubai, Tbilisi, Baku
UTC+5: Karachi, Tashkent, Maldives
UTC+5:30: Mumbai, Kolkata, New Delhi
UTC+8: Beijing, Shanghai, Singapore, Perth
UTC+9: Tokyo, Seoul, Pyongyang
UTC+10: Sydney, Melbourne, Guam
UTC-5: New York (EST), Toronto (EST), Lima
UTC+8: Los Angeles (PST), San Francisco (PST), Vancouver (PST)
避けるべきよくある間違い
間違い 1: UTC = GMT を常に想定する
多くの場合、これらは等しいですが、最大 0.9 秒異なる場合があります。高精度アプリケーションの場合は、明示的に UTC を使用します。
// ❌ Incorrect: Using GMT interchangeably with UTC
const gmtTime = new Date().toGMTString(); // Deprecated method
// ✅ Correct: Using UTC explicitly
const utcTime = new Date().toISOString(); // Proper UTC format
間違い 2: UTC ではなく現地時間を保存する
タイムスタンプは常に UTC で保存され、表示の場合のみ現地時間に変換されます。
// ❌ Incorrect: Storing local time in database
const localTime = new Date().toLocaleString();
db.save({ created_at: localTime }); // Ambiguous time zone
// ✅ Correct: Storing UTC timestamp in database
const utcTimestamp = Date.now();
db.save({ created_at: utcTimestamp }); // Universal reference
間違い 3: タイム ゾーン データベース ルールを無視する
固定のタイムゾーンオフセットを想定しないでください。正確な変換には IANA タイムゾーン データベースを使用します。
// ❌ Incorrect: Assuming fixed offset for a location
const tokyoOffset = 9 * 60 * 60 * 1000; // UTC+9 in milliseconds
// ✅ Correct: Using IANA time zone database
const tokyoTime = new Date().toLocaleString('en-US', { timeZone: 'Asia/Tokyo' });
ベストプラクティス
開発者向け
- 常にタイムスタンプを UTC でデータベースに保存
- 文字列表現には ISO 8601 形式を使用:
2026-01-01T12:00:00Z - ユーザーのローカル タイムゾーンで時刻を表示し、UX を向上させます
- IANA タイム ゾーン識別子を使用します (例:
ESTではなく、America/New_York) - 適切なタイムゾーン ライブラリを使用して 夏時間を処理
推奨ライブラリ
| 言語 | 図書館 | 目的 |
|---|---|---|
| JavaScript | date-fns-tz、luxon、moment-timezone | タイムゾーンの処理 |
| パイソン | pytz、zoneinfo (Python 3.9+) | タイムゾーンの処理 |
| ジャワ | java.time (Java 8+) | タイムゾーンと日付の処理 |
| 行く | time パッケージ (標準ライブラリ) | タイムゾーンの処理 |
| ルビー | tzinfo | タイムゾーンの処理 |
結論
UTC と GMT は異なる目的を果たします。
- UTC は、原子時計に基づいた最新の正確な時間標準です。
- GMT は主に太陽時間に基づく英国のタイムゾーン名です
ソフトウェア開発およびグローバル システムでは、常に UTC を時間標準として使用します。 GMT は、英国のタイムゾーン表現または従来のシステムとの互換性が特に必要な場合にのみ使用してください。
関連ツール
- Unix タイムスタンプ コンバーター - Unix タイムスタンプと日付の間の変換
- ISO 8601 コンバーター - ISO 8601 タイムスタンプを使用します。
- タイムゾーンコンバータ - タイムゾーン間の時間を変換します
- 現在のタイムスタンプ - 現在の UTC 時刻を複数の形式で取得します
よくある質問
Q: UTC は GMT と同じですか?
A: 日常の使用では同じように扱われることが多いですが、最大 0.9 秒の差が生じる場合があります。 UTC は原子時計に基づいており、GMT は太陽観測に基づいています。
Q: UTC では夏時間が適用されますか?
A: いいえ、UTC が夏時間に変更されることはありません。それは一定の時間基準です。タイムゾーンは UTC からのオフセットを調整することがありますが (例: UTC+1 から UTC+2)、UTC 自体は変更されません。
Q: タイムゾーン設定に「GMT」が表示されるのはなぜですか?
A: 多くのシステムでは、UTC+0 の従来の名前として「GMT」が使用されています。最新のアプリケーションでは、これは通常、天文学的なグリニッジ標準時ではなく、UTC+0 タイム ゾーンを指します。
Q: タイムゾーンはいくつありますか?
A: 標準タイム ゾーンは 24 あります (UTC-12 から UTC+14) が、IANA データベースには、過去の変更、DST 規則、地域の違いを考慮して 400 以上の名前付きタイム ゾーンが含まれています。
Q: アプリケーションでは UTC または GMT を使用する必要がありますか?
A: UTC を使用します。これは、ほぼすべてのプログラミング言語、データベース、API で使用されている最新の標準です。特に英国のタイムゾーン表現が必要な場合にのみ、GMT を使用してください。