Earth Engine 即將推出
非商業用途的配額級別,以便保護共用運算資源,並確保所有使用者都能享有穩固效能。所有非商業用途的專案都必須在
2026 年 4 月 27 日前選取配額級別,否則屆時會預設為「社群」級別。在
2026 年 4 月 27 日,所有專案 (無論選取級別的日期為何) 的級別配額都會生效。
瞭解詳情。
ee.Date
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
建構新的 Date 物件。
| 引數 | 類型 | 詳細資料 |
|---|
date | ComputedObject|Date|Number|String | 要轉換的日期,可以是下列其中一種:數字 (自 Epoch 紀元以來的毫秒數)、ISO 日期字串、JavaScript 日期或 ComputedObject。 |
tz | 字串 (選用) | 選填時區,僅適用於字串日期。 |
範例
程式碼編輯器 (JavaScript)
// Numeric inputs are interpreted as milliseconds from Unix epoch.
print(ee.Date(0)); // Date (1970-01-01 00:00:00)
// Scale factors can make numerical inputs more readable (e.g. 60 seconds).
print(ee.Date(60 * 1000)); // Date (1970-01-01 00:01:00)
// ISO 8601 date string input examples.
print(ee.Date('2020')); // Date (2020-01-01 00:00:00)
print(ee.Date('2017-6-24')); // Date (2017-06-24 00:00:00)
print(ee.Date('2017-06-24')); // Date (2017-06-24 00:00:00)
print(ee.Date('2017-6-24T00:14:46')); // Date (2017-06-24 00:14:46)
print(ee.Date('2017-06-24T23:59:59')); // Date (2017-06-24 23:59:59)
// With an optional time zone.
print(ee.Date('2020', 'US/Mountain')); // Date (2020-01-01T07:00:00)
// Convert JavaScript now to Earth Engine Date
print(ee.Date(Date.now()));
Python 設定
請參閱
Python 環境頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。
import ee
import geemap.core as geemap
Colab (Python)
from datetime import datetime
# Numeric inputs are interpreted as milliseconds from Unix epoch.
display(ee.Date(0).format()) # 1970-01-01T00:00:00
# Scale factors can make numerical inputs more readable (e.g. 60 seconds).
display(ee.Date(60 * 1000).format()) # 1970-01-01T00:01:00
# ISO 8601 date string input examples.
display(ee.Date('2020').format()) # 2020-01-01T00:00:00
display(ee.Date('2017-6-24').format()) # 2017-06-24T00:00:00
display(ee.Date('2017-06-24').format()) # 2017-06-24T00:00:00
display(ee.Date('2017-6-24T00:14:46').format()) # 2017-06-24T00:14:46
display(ee.Date('2017-06-24T23:59:59').format()) # 2017-06-24T23:59:59
# With an optional time zone.
display(ee.Date('2020', 'US/Mountain').format()) # 2020-01-01T07:00:00
# Convert Python datetime.now() to Earth Engine Date
display(ee.Date(datetime.now()).format())
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-10-30 (世界標準時間)。
[null,null,["上次更新時間:2025-10-30 (世界標準時間)。"],[],["The `ee.Date` function creates a new Date object, accepting various inputs: milliseconds since the epoch, ISO date strings, JavaScript Dates, or ComputedObjects. It can use numeric inputs, interpreted as milliseconds, or date strings following ISO 8601 format. An optional timezone argument (string) can be provided with string date input to specify the timezone. The function returns a Date object and examples in JavaScript and Python are provided.\n"]]