ee.Date.update

將指定日期的其中一或多個單位設為新值,即可建立新日期。如果提供時區,系統會以該時區解讀新值。

用量傳回
Date.update(year, month, day, hour, minute, second, timeZone)日期
引數類型詳細資料
這個:date日期
year整數,預設值為 null
month整數,預設值為 null
day整數,預設值為 null
hour整數,預設值為 null
minute整數,預設值為 null
second數字,預設值:null
timeZone字串,預設值為空值時區 (例如「America/Los_Angeles」);預設為世界標準時間。

範例

程式碼編輯器 (JavaScript)

var date = ee.Date('2021-4-30T07:15:31.24');

print('Updated year and minute components of the input date',
  date.update({
    year: 2010,
    minute: 59
  })
);

Python 設定

請參閱 Python 環境頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。

import ee
import geemap.core as geemap

Colab (Python)

date = ee.Date('2021-4-30T07:15:31.24')

display(
    'Updated year and minute components of the input date:',
    date.update(year=2010, minute=59)
)